exe的按钮有没有快捷键? 如果没有的话你可以用API函数sendmessage或postmessage 来模拟点击它,你可以参考下面代码
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()
Print 1
End Sub
Private Sub Command2_Click()
PostMessage Command1.hwnd, WM_LBUTTONDOWN, 0, 0 '对按钮1按下鼠标左键
PostMessage Command1.hwnd, WM_LBUTTONUP, 0, 0 '放开鼠标左键
End Sub
模拟点击用 api 函数PostMessage 发送鼠标双击消息。
个人觉得你要允许某软件的话,直接用Shell比较好点。
需要看到屏幕上鼠标指针移动效果么??