我的目的是让这个程序能自动过一段时间向一个第三方窗口发送鼠标点击的命令,代码如下
Private Declare Function PostMessage& Lib "user32 " Alias "PostMessageA " (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Timer1_Timer()
Dim a As Long
Dim t As Long
t = 100 * &H10000 + 100
hwnd = FindWindow(vbNullString, Text1.Text)
PostMessage hwnd, WM_LBUTTONDOWN, 0&, t
PostMessage hwnd, WM_LBUTTONUP, 0&, t
End Sub
结果跳出的错误是,找不到函数接口或是使用了VB不支持的自动类型??小弟纯新手跪求指点!!
Private Declare Function PostMessage& Lib "user32 " Alias "PostMessageA " (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Timer1_Timer()
Dim a As Long
Dim t As Long
t = 100 * &H10000 + 100
hwnd = FindWindow(vbNullString, Text1.Text)
PostMessage hwnd, WM_LBUTTONDOWN, 0&, t
PostMessage hwnd, WM_LBUTTONUP, 0&, t
End Sub
结果跳出的错误是,找不到函数接口或是使用了VB不支持的自动类型??小弟纯新手跪求指点!!