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
展开
 我来答
风雪剑无痕
2012-06-30 · TA获得超过1253个赞
知道大有可为答主
回答量:1691
采纳率:100%
帮助的人:1677万
展开全部
三个api函数齐了,WM_KEYDOWN和WM_KEYUP这两个常量没看见赋值,如果没赋值就赋下值:
Private Const WM_KEYDOWN = &H100
Private Const WM_KEYUP = &H101
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式