vb向指定的后台程序发送指令没反应,请给位大侠帮帮忙。。问题解决追加分数。
PrivateDeclareSubSleepLib"kernel32"(ByValdwMillisecondsAsLong)PrivateDeclareFunctionF...
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 Sub Form_Load()
Dim pid
pid = Shell("D:\demul\demul.exe", 0)
Label1.Caption = pid
Sleep 3000
Dim hwnd
hwnd = FindWindow("Demul", vbNullString)
SendMessage hwnd, WM_KEYDOWN, 18, &H11C0001
SendMessage hwnd, WM_KEYUP, 18, &H11C000
Sleep 500
SendMessage hwnd, WM_KEYDOWN, 40, 0
SendMessage hwnd, WM_KEYUP, 40, 0
End Sub 展开
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 Sub Form_Load()
Dim pid
pid = Shell("D:\demul\demul.exe", 0)
Label1.Caption = pid
Sleep 3000
Dim hwnd
hwnd = FindWindow("Demul", vbNullString)
SendMessage hwnd, WM_KEYDOWN, 18, &H11C0001
SendMessage hwnd, WM_KEYUP, 18, &H11C000
Sleep 500
SendMessage hwnd, WM_KEYDOWN, 40, 0
SendMessage hwnd, WM_KEYUP, 40, 0
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询