VB做QQ游戏刷屏的问题。
私有声明函数FindWindow Lib "user32 "别名" FindWindowA" (ByVal lpClassName为字符串,ByVal lpWindowName为字符串)为Long
私有声明函数getwindowtextlib“user 32”别名“GetWindowTextA”(ByVal Hwnd为Long,ByVal lpString为String,ByVal cch为Long)为Long
私有声明函数GetWindow Lib“user 32”(ByVal Hwnd一样长,ByVal wCmd一样长)一样长
私有声明函数GetDesktopWindow Lib "user32 "()为Long
私有声明函数GetClassName Lib "user32 "别名" GetClassNameA" (ByVal Hwnd为Long,ByVal lpClassName为String,ByVal nMaxCount为Long)为Long
私有声明函数SendMessage Lib“user 32”别名“SendMessage a”(ByVal Hwnd为Long、ByVal wMsg为Long、ByVal wParam为Long、ByVal lParam为String)为Long
私有声明函数SetWindowPos Lib " user 32 "(ByVal Hwnd As Long、ByVal hWndInsertAfter As Long、ByVal x As Long、ByVal y As Long、ByVal cx As Long、ByVal cy As Long、ByVal w flags As Long)Long
私有声明子睡眠库“kernel 32”(ByVal dw milliseconds一样长)
私有声明函数PostMessage Lib“user 32”别名“PostMessageA”(ByVal Hwnd为Long,ByVal wMsg为Long,ByVal wParam为Long,ByVal lParam为Long)为Long
私有常量WM _ SETTEXT = & ampHC
私有常量GW_HWNDFIRST = 0
私有常量GW_HWNDNEXT = 2
私有常量GW_CHILD = 5
私有常量WM _ KEYDOWN = & ampH100
私人常数WM _ KEYUP = & ampH101
Dim A() As Long '定义数组。
私有子命令1_Click()
Temp = True
将Ai设为整数
将Ak标注为整数
Dim Hwnd一样长,l一样长
Dim s为字符串,T为字符串
List1。清楚的
Hwnd = GetDesktopWindow()
Hwnd = GetWindow(Hwnd,GW_CHILD或GW_HWNDFIRST)
而Hwnd & lt& gt0
Hwnd = GetWindow(Hwnd,GW_HWNDNEXT)
s =字符串(256,Chr(0))
GetClassName Hwnd,s,255
s = Replace(s,Chr(0),"")
T =字符串(256,Chr(0))
GetWindowText Hwnd,T,255
T = Replace(T,Chr(0),"")
多项活动
如果right (s,11)= " 8:10011:0 "和left (s,4) = "afx:" and t = "QQ game "那么'窗口类名要匹配。
“EnumallHandleswnd”枚举所有子控件/窗口。
如果…就会结束
行
如果列表1。ListCount & gt那么0
ReDim A(0到List1。ListCount - 1)一样长
将I标注为整数
对于i = 0至下界(A)
A(i) = Val(Mid(List1。清单(一),4))
T = mid (list1.list (i),instr (list1.list (i),"父句柄类型")+6)。
T = Left(T,8)
如果T & lt& gt那就“组合框”
A(i) = 0
如果…就会结束
接下来我
其他
Temp = False
MsgBox“游戏窗口未找到”,vbCritical,“错误”
出口接头
如果…就会结束
如果列表1。ListCount & gt那么0
对于i = 0至下界(A)
如果A(I)& lt;& gt那么0
l = SendMessage(A(i),WM_SETTEXT,0," aaaaaa " & ampChr(0))
睡眠10
多项活动
l = PostMessage(A(i),WM_KEYDOWN,vbKeyReturn,0)
睡眠10
多项活动
l = PostMessage(A(i),WM_KEYUP,vbKeyReturn,0)
睡眠10
多项活动
如果…就会结束
接下来我
如果…就会结束
末端接头
私有子枚举句柄(ByVal Hwnd As Long)
Dim hn一样长
Dim firsthd As Long
Dim s为字符串,T为字符串
firsthd = GetWindow(Hwnd,GW_CHILD)
firsthd = GetWindow(firsthd,GW_HWNDFIRST)
hn = firsthd
当hn & lt& gt0
s =字符串(256,Chr(0))
255英镑
s = Replace(s,Chr(0),"")
T =字符串(256,Chr(0))
GetClassName Hwnd,T,255
T = Replace(T,Chr(0),"")
多项活动
如果s = "Edit "那么'如果它满足要求,它将被添加到列表中。
List1。AddItem " handle:" &;hn & amp"父句柄:" &;Hwnd & amp" Class & amp:" &;标准普尔。"父句柄类型:" &;T & ampvbCrLf
如果…就会结束
EnumAllHandles hn '递归搜索,不要放过子控件。
hn = GetWindow(hn,GW_HWNDNEXT)
如果hn = firsthd,则退出Do
环
末端接头
私有子命令2_Click()
末端接头