Dim QM  //QQ号数组
Dimenv QQ号,密码, 记录, 数量,Check数量,QQ总数, again, AllPath
AllPath = "C:\" //long.txt路径
wtime = CInt(Form1.InputBox操作延迟.Text)
循环 = Form1.CheckBox1.Value
数量 = Form1.ComboBox1.ListIndex + 1
Dim 句柄(9) //挂QQ的句柄
Check数量 = 0
again = 1
挂机时长 = Clng(Form1.InputBox挂机时长.Text)
Call start()

Sub start()
If Plugin.File.IsFileExit("C:\挂机记录.ini") = True Then 
	记录 = WRjilu(1,0)
	Else 
	记录 = Form1.InputBox位置.Text
End If
QQList = WRini(4, 0, 0)
If QQList <> "0" Then 
	QM = split(QQList, "|")
	QQ总数 = UBound(QM)
	If CInt(记录) <= CInt(QQ总数) Then 
		If CInt(数量) <= CInt(QQ总数) Then 
			QQ号 = QM(CInt(记录) - 1)
			密码 = WRini(1, QQ号, 0)
			TracePrint "QQ号:" & QQ号 & "密码" & 密码
			If Form1.InputBoxQQpath.text <> "" Then 
				RunApp Form1.InputBoxQQpath.text
				Else 
				MessageBox "请选择QQ启动程序,或者先保存设置."
				EndScript 
			End If
			Delay Form1.InputBox启动延时.Text * 1000
			HwndEx = Plugin.Window.Search("QQ2012")
			TracePrint "搜索到QQ句柄:" & HwndEx
			If HwndEx <> -1 Then 
				Dim TmpHwnd
				TmpHwnd = split(HwndEx, "|")
				ii = 0
				For ii = 0 To CInt(UBound(TmpHwnd)-1)
					HwndTMP = Plugin.Window.FindEx(TmpHwnd(ii), 0, "Edit", 0)
					If HwndTMP > 0 Then 
						ii = CInt(UBound(TmpHwnd) - 1)
						Hwnd = TmpHwnd(ii)
					End If
				Next
				TracePrint "确定QQ句柄:" & Hwnd
				If Hwnd > 0 Then 
					Call QQlogo(Hwnd)
					Else 
					Call Plugin.File.WriteFileEx(AllPath & "Log.txt",Plugin.Sys.GetDateTime()&"  找不到QQ登录程序,请检查设置,脚本停止。")
					MessageBox "找不到QQ登录程序,请检查设置。"
					EndScript 
				End If	
			End If
			Else 
			MessageBox "挂机数量不能大于QQ总数。"
			EndScript 
		End If
		ElseIf CInt(记录) > CInt(QQ总数) Then
		MessageBox "开始位置不能大于QQ总数"
		EndScript 
	End If
	ElseIf QQList = "0" Then
	MessageBox "没有可以登录的QQ号,脚本将停止。"
	EndScript 
End If
End Sub



Sub QQlogo(a)
	HwndEx = Plugin.Window.FindEx(Hwnd, 0, "Edit", 0)
	Call Plugin.Bkgnd.LeftClick(a, 274, 160)
	Delay wtime *1000
	Call Plugin.Bkgnd.KeyPress(a, 8)
	Call Plugin.Bkgnd.SendString(a, QQ号)
	Delay wtime *1000
	Call Plugin.Bkgnd.LeftClick(HwndEx, 147, 11)
	ii = 1
	For ii = 1 To len(密码)
	Delay wtime * 1000
	Call Plugin.Bkgnd.KeyPress(HwndEx, Asc(UCase(Mid( 密码,ii,1))))
	Next
	Delay wtime * 1000
	Call Plugin.Bkgnd.LeftClick(a, 344, 265)
	Call Plugin.File.WriteFileEx(AllPath & "Log.txt",Plugin.Sys.GetDateTime()&"  登录QQ:" & QQ号)
	Delay CInt(Form1.InputBox登录延时.Text) * 1000
	Call CheckAll()
End Sub


//各种检查
Sub CheckAll()
	Hwnd = Plugin.Window.Find("TXGuiFoundation", "密码验证错误")
	If Hwnd > 0 Then 
		Call Plugin.Bkgnd.LeftClick(Hwnd, 367, 16)
		记录 = 记录 + 1