Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Sub Command1_Click()
MsgBox "成功!"
End Sub
Private Sub Command2_Click() '将Command1.hwnd改为其它窗体按钮句柄即可实现点击
SendMessage Command1.hwnd, WM_LBUTTONDOWN, 1, ByVal 0
SendMessage Command1.hwnd, WM_LBUTTONUP, 0, ByVal 0
End Sub