If Dir(\"alive\") <> \"\" And Dir(\"ideal\") <> \" Then Print \"strive\" End If
[此贴子已经被作者于2007-4-20 14:58:05编辑过]
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
Private Const WM_KEYDOWN = &H100
Private Sub Command1_Click()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
Dim hwnd As Long '
hwnd = FindWindow(vbNullString, "Crazy Arcade")
If hwnd = 0 Then
Label1.Caption = "未运行"
Else
Label1.Caption = "已运行"
SendMessage findhwnd, WM_KEYDOWN, 65, 1& 这个出错了。如果我要向 泡泡堂 发送一个字符怎么改? (比如我发送 : 你好 )怎么样才能不出现DLL错误?
End If
End Sub
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
Private Sub Command1_Click()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
Dim hwnd As Long '
hwnd = FindWindow(vbNullString, "Crazy Arcade")
If hwnd = 0 Then
Label1.Caption = "未运行"
Else
Label1.Caption = "已运行"
SendMessage findhwnd, wm_keydown, 65, 0& (虽然不会出现DLL错误,但不会输入A。。????)
End If
End Sub
师傅这个是改你编的程序,发现一个问题,这个程序只对你编的另一个窗体有效果,对其他任何一个活动窗体不起作用。。
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Any) As Long
Private Const WM_KEYDOWN = &H100
Private Sub Command1_Click()
Timer1.Interval = 500
End Sub
Private Sub Timer1_Timer()
Dim hwnd As Long '
hwnd = FindWindow(vbNullString, "Crazy Arcade")
If hwnd = 0 Then
Label1.Caption = "未运行"
Else
Label1.Caption = "已运行"
SendMessage findhwnd, wm_keydown, 65, 0&
End If
End Sub
[此贴子已经被作者于2007-4-20 18:55:26编辑过]