在VB里面如何用postmessage函数向已知句柄的窗体发送单击鼠标的消息

2024-12-04 08:45:06
推荐回答(3个)
回答1:

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 Sub Command1_Click()
MsgBox "123"
End Sub

Private Sub Command2_Click()
PostMessage Command1.hwnd, WM_LBUTTONDOWN, 0, 0
PostMessage Command1.hwnd, WM_LBUTTONUP, 0, 0
End Sub

回答2:

一楼正解

回答3:

不对