SendMessage如何向另一程序的多个text发送消息
SendMessage向另一程序的多个text发送消息,另一程序有6个text 我现想用一个程序向它发送消息,但是只能发送两个,发送多个的代码我不会写,希望懂的朋友帮忙一下,谢谢。我现在用的代码 DoEvents
Dim QQHwnd As Long, RHwnd As Long, subhwnd As Long, subhwnd1 As Long
QQHwnd = FindWindow(vbNullString, "验证信息") '捕捉窗口
subhwnd = FindWindowEx(QQHwnd, 0, "WindowsForms10.EDIT.app.0.218f99c", vbNullString)
subhwnd1 = FindWindowEx(QQHwnd, 0, "WindowsForms10.EDIT.app.0.218f99c", vbNullString)
Do While subhwnd > 0
subhwnd = FindWindowEx(QQHwnd, subhwnd, "WindowsForms10.EDIT.app.0.218f99c", vbNullString) '捕捉第2个文本框
Exit Do
Do While subhwnd > 0
subhwnd1 = FindWindowEx(QQHwnd, subhwnd, "WindowsForms10.EDIT.app.0.218f99c", vbNullString) '捕捉第2个文本框
Exit Do
Loop
Loop
RHwnd = FindWindowEx(QQHwnd, 0, "WindowsForms10.BUTTON.app.0.218f99c", "登录")
SendMessage subhwnd, WM_SETTEXT, 0, ByVal user.Text 'Text2文本框内为 主程序放入另一个应用程序的文本框的值.
SendMessage subhwnd1, WM_SETTEXT, 0, ByVal pws.Text
SendMessage RHwnd, BM_CLICK, 0, 0 '点击确定按钮