Dim UseNum
Dim UseStatus
Dim StatusIco
Dim Path
Dim strQQMailTip
Dim CurrentWidth

'注释

sub Window_OnInit()	
	Window.GetScriptVersion "1.0" 	
	StatusIcon = "Offline.ico"
	UseStatus = "离线"
	Path = "NewSkins\\QQ2004\\"
	UseNum = "0" + UseStatus
	'strQQMailTip = "您没有新邮件"

End sub

sub Window_OnSize(cx,cy)
	Window.LockPaint()
	CurrentWidth = cx
	BG.width = cx - 6
	BG.Height = cy
	title.width = cx
    sysleftline.height = cy - 7
	sysrightline.height = cy - 7
	sysrightline.left = cx-3
       
    TitleMiddle.left = TtileLeft.width
    TitleMiddle.width = cx - TtileLeft.width - 41
        
	TitleRight.left = cx - TitleRight.width
	'TitleBtns1.left = TitleRight.left + 1
	min1.left = cx - 40
	ColoBtn.left = min1.left+11
	close1.left = ColoBtn.left+11


    sysbottom.top = cy - 7
    sysbottom1.top = sysbottom.top
    sysbottom1.left = cx - 8
    sysbottom2.top = cy - 3
    sysbottom2.width = cx - 16

	'边框

	BarFrame.top = 54
	BarFrame.width = cx +1
	BarFrame.height = cy  - BarFrame.top - 16



	
	QQMailTip.label = strQQMailTip


	Bar1.width = BarFrame.width - 6
	Bar1.height = BarFrame.height - 7 

	QQMain.top = cy-19 	'23
	
	searchBtn.Top = QQMain.top
	ChatBtn.top = QQMain.top
	PhoneBtn.top = QQMain.top
	
	QQMain.Left = 12
	searchBtn.Left = QQMain.Left +20
	PhoneBtn.Left = searchBtn.Left+20
	ChatBtn.Left = PhoneBtn.Left+20
	QQBar.left=ChatBtn.Left+20
	QQBar.top	= QQMain.top

	SysMsgBtn.top = 3
	SysMsgBtn.Left = 7
	MyQQNum.top = SysMsgBtn.top	
	MyQQNum.Left = SysMsgBtn.Left +14

	QQMailTip.top=38	'cy-19
	QQMailTip.left=78
	QQHosting.top=QQMailTip.top 
	QQHosting.left=38
	MyQQNum1.top = 23
	MyQQNum1.left = 42

	Window.UnLockPaint()
	 
end sub

'上面的三个按钮

sub min1_onClick()
	Window.ExeCommand 1,2
end sub

sub close1_onClick()
	Window.ExeCommand 1,3
end sub


'六个Bar按钮
Sub Window_onClick(code, Name)
	'Window.LockPaint()
	Window.DisableBar CStr(Name)
	Window.ExeCommand code,CStr(Name)
	Window.UnLockPaint()
End sub

sub QQBAR_onClick()
	Window.ExeCommand 4,9
end Sub

sub SysMsgBtn_onMouseMove(nX,nY)
	s = CStr(SysMsgBtn.Left) & "." & CStr(SysMsgBtn.Top) & "." & CStr(SysMsgBtn.width) & "." & CStr(SysMsgBtn.height)
	Window.ExeCommand 20,s
end Sub

sub SysMsgBtn_onMouseLeave()
	s = CStr(SysMsgBtn.Left) & "." & CStr(SysMsgBtn.Top) & "." & CStr(SysMsgBtn.width) & "." & CStr(SysMsgBtn.height)
	Window.ExeCommand 21,s
end Sub



Sub StatusPic_onClick()
	s = CStr(StatusPic.left-10)&"."&CStr(StatusPic.top+20)
	Window.ExeCommand 6,s
End Sub

Sub QQMailTip_onClick()
	Window.ExeCommand 7,1	
End Sub

Sub QQHosting_onClick()
	Window.ExeCommand 15,1	
End Sub


sub ChatBtn_onClick()
	Window.ExeCommand 4,1
end Sub

Sub PhoneBtn_onClick()
	Window.ExeCommand 4,2
end sub

sub searchBtn_onClick()
	Window.ExeCommand 4,3
end sub


sub SysMsgBtn_onClick()
	Window.ExeCommand 4,6
end sub

sub ColoBtn_onClick()
        ColoBtn.SetLighting(false)
        Window.ExeCommand 4,7
end Sub



sub QQMain_onClick()
	s = CStr(QQMain.Left)&"."&CStr(QQMain.Top)
	Window.ExeCommand 5,s
end sub


'处理QQ程序发来的事件
Sub Window_OnNotify(code ,var)
	if code = 1 then
		'设置当前的Uin
		UseNum = var
			MyQQNum1.label= UseNum  + UseStatus
			MyQQNum.value= "" 
	elseif code = 2 then
		'闪系统消息按钮 var 为1是开始闪。为2是停止
		if(var = 1) then
			SysMsgBtn.StopFlash
			SysMsgBtn.Flash 30
		else
			SysMsgBtn.StopFlash
		end if
	elseif code = 3 then
		'闪状态按钮 var 为0,1,2,3是对应的ico。为4表示停止
		if var = 0 then
			StatusPic.ico = "Online.ico"		
		elseif var = 1 Then
			StatusPic.ico = "leave.ico"		
		elseif var = 2 Then
			StatusPic.ico = "invisible.ico"		
		elseif var = 3 Then
			StatusPic.ico = "Offline.ico"		
		elseif var = 4 then
			StatusPic.Ico = StatusIco	
		end if
	elseif code = 4 then
		'设置那个Bar在最前
			Window_onClick 2,Var
	elseif code = 5 then
		'设置当前的状态。
		if var = 10 Then	
			UseStatus = "(在线)"		
			StatusIco = "Online.ico"
		elseif var = 20 Then
			UseStatus = "(离线)"			
			StatusIco = "Offline.ico"
		elseif var = 30 Then	
			UseStatus = "(离开)"		
			StatusIco = "leave.ico"
		elseif var = 40 Then	
			UseStatus = "(隐身)"		
			StatusIco = "invisible.ico"			
		end if
		StatusPic.ico = StatusIco
	   	MyQQNum1.label = UseNum  + UseStatus
		MyQQNum.value= ""
	elseif code  = 6 then
		'设置Skin的起始路径
		Path = Var	
	elseif code = 100 then
		'改变QQMail的提示
		strQQMailTip = "(" + CStr(var) + ")"
		QQMailTip.label = strQQMailTip		
	elseif code = 101 then
		QQHosting.label = "(" + CStr(var) + ")"
	ElseIf code = 25 Then
		' 皮肤推送
		if(var = 1) then
			ColoBtn.SetLighting(true)
		else
			ColoBtn.SetLighting(false)
		end If
			
	end If
	'code = 50 已经用于皮肤支持来消息后闪动

end sub