用api怎么做?Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Sub Command1_Click()
Dim dHwnd As Long, tHwnd As Long
tHwnd = FindWindow("WindowsForms10.Window.8.app.0.378734a", "标题"
If tHwnd > 0 Then
PostMessage tHwnd ,WM_LBUTTONDOWN, 0, 0
PostMessage tHwnd, WM_LBUTTONUP, 0, 0
End If
End Sub
vb 如何向已知句柄的按钮发送鼠标点击?
答案:2 悬赏:10 手机版
解决时间 2021-03-04 15:25
- 提问者网友:泪痣哥哥
- 2021-03-04 00:25
最佳答案
- 五星知识达人网友:何以畏孤独
- 2021-03-04 01:04
向按钮发送坐标1,1的左键按下左键弹起消息就是了
其中WM_LBUTTONDOWN,WM_LBUTTONUP的常量值以及PostMessage的声明可以在api浏览器查。Gwnd是句柄
PostMessage Gwnd, WM_LBUTTONDOWN, 0, ByVal (1 + 1 * 65536)
PostMessage Gwnd, WM_LBUTTONUP, 0, ByVal (1 +1 * 65536)
其中WM_LBUTTONDOWN,WM_LBUTTONUP的常量值以及PostMessage的声明可以在api浏览器查。Gwnd是句柄
PostMessage Gwnd, WM_LBUTTONDOWN, 0, ByVal (1 + 1 * 65536)
PostMessage Gwnd, WM_LBUTTONUP, 0, ByVal (1 +1 * 65536)
全部回答
- 1楼网友:狂恋
- 2021-03-04 01:44
private declare function postmessage& lib "user32" alias "postmessagea" (byval hwnd as long, byval wmsg as long, byval wparam as long, lparam as any)
private const bm_click = &hf5
postmessage hwnd,bm_click, 0, byval 0&
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯