VB制作模拟按键问题
我用VB制作模拟按键想让QQ自动登陆,QQ帐号成功输入号码,可是密码无法输入,代码如下:DimaAsStringDimhwnd1,hwnd2,hwnd3AsLongWin...
我用VB制作模拟按键想让QQ自动登陆,QQ帐号成功输入号码,可是密码无法输入,代码如下:
Dim a As String
Dim hwnd1, hwnd2, hwnd3 As Long
WinExec "D:\Program Files\Tencent\QQ\Bin\QQ.exe", 0
Sleep 1000
hwnd1 = FindWindow(vbNullString, Text3.Text)
hwnd2 = FindWindowEx(hwnd1, 0, "ATL:30A3A470", vbNullString)
hwnd3 = FindWindowEx(hwnd1, 0, "Edit", vbNullString)
SendMessageByString& hwnd2, WM_SETTEXT, 0, Text1.Text ,QQ帐号成功输入
SendMessageByString& hwnd3, WM_SETTEXT, 0, Text2.Text ,QQ密码无法输入
PostMessage hwnd2, WM_KEYDOWN, vbKeyReturn, 0
End Sub 展开
Dim a As String
Dim hwnd1, hwnd2, hwnd3 As Long
WinExec "D:\Program Files\Tencent\QQ\Bin\QQ.exe", 0
Sleep 1000
hwnd1 = FindWindow(vbNullString, Text3.Text)
hwnd2 = FindWindowEx(hwnd1, 0, "ATL:30A3A470", vbNullString)
hwnd3 = FindWindowEx(hwnd1, 0, "Edit", vbNullString)
SendMessageByString& hwnd2, WM_SETTEXT, 0, Text1.Text ,QQ帐号成功输入
SendMessageByString& hwnd3, WM_SETTEXT, 0, Text2.Text ,QQ密码无法输入
PostMessage hwnd2, WM_KEYDOWN, vbKeyReturn, 0
End Sub 展开
1个回答
展开全部
将两个发送消息分开写,默认发送第一个消息
SendMessageByString& hwnd2, WM_SETTEXT, 0, Text1.Text ,QQ帐号成功输入
SendMessageByString& hwnd3, WM_SETTEXT, 0, Text2.Text ,QQ密码无法输入
PostMessage hwnd2, WM_KEYDOWN, vbKeyReturn, 0
这是
少一个
PostMessage hwnd3, WM_KEYDOWN, vbKeyReturn, 0
最好写成
SendMessageByString& hwnd2, WM_SETTEXT, 0, Text1.Text ,QQ帐号成功输入
PostMessage hwnd2, WM_KEYDOWN, vbKeyReturn, 0
SendMessageByString& hwnd3, WM_SETTEXT, 0, Text2.Text ,QQ密码无法输入
PostMessage hwnd3, WM_KEYDOWN, vbKeyReturn, 0
SendMessageByString& hwnd2, WM_SETTEXT, 0, Text1.Text ,QQ帐号成功输入
SendMessageByString& hwnd3, WM_SETTEXT, 0, Text2.Text ,QQ密码无法输入
PostMessage hwnd2, WM_KEYDOWN, vbKeyReturn, 0
这是
少一个
PostMessage hwnd3, WM_KEYDOWN, vbKeyReturn, 0
最好写成
SendMessageByString& hwnd2, WM_SETTEXT, 0, Text1.Text ,QQ帐号成功输入
PostMessage hwnd2, WM_KEYDOWN, vbKeyReturn, 0
SendMessageByString& hwnd3, WM_SETTEXT, 0, Text2.Text ,QQ密码无法输入
PostMessage hwnd3, WM_KEYDOWN, vbKeyReturn, 0
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询