展开全部
用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 Sub Command1_Click()
PostMessage Command2.hwnd, &H201, 0&, 0&
PostMessage Command2.hwnd, &H202, 0&, 0&
End Sub
Private Sub Command2_Click()
Static i As Long
i = i + 1
Print "command2按钮点了" & i & "次"
End Sub
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()
PostMessage Command2.hwnd, &H201, 0&, 0&
PostMessage Command2.hwnd, &H202, 0&, 0&
End Sub
Private Sub Command2_Click()
Static i As Long
i = i + 1
Print "command2按钮点了" & i & "次"
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询