VB6 虚拟键盘
键盘能控制的SWF文件,想通过虚拟键盘控制,已经试过PrivateSubKeyboard(ValueAsInteger)DimhwdAsLongDimhwdeXAsLon...
键盘能控制的SWF文件,想通过虚拟键盘控制,已经试过
Private Sub Keyboard(Value As Integer)
Dim hwd As Long
Dim hwdeX As Long
Dim ret As Long
'1
keybd_event Value, MapVirtualKey(Value, 1), 0, 0 '按下A键
keybd_event Value, MapVirtualKey(Value, 1), KEYEVENTF_KEYUP, 0 '释放A键
'2
hwdeX = FindWindow(vbNullString, "Adobe Flash Player 13")
ret = PostMessage(hwdeX, WM_KEYDOWN, Value, 0&)
Sleep 200
ret = PostMessage(hwdeX, WM_UP, Value, 0&)
End Sub
可还是不能控制!还有什么办法?
上面两种方式都可以实现普通虚拟按键,都能对其他SWF进行控制,但是现在的是一个特殊的SWF文件,不知道作者在里面加入了什么判断,无法控制。文件地址:http://pan.baidu.com/s/14cJG6 展开
Private Sub Keyboard(Value As Integer)
Dim hwd As Long
Dim hwdeX As Long
Dim ret As Long
'1
keybd_event Value, MapVirtualKey(Value, 1), 0, 0 '按下A键
keybd_event Value, MapVirtualKey(Value, 1), KEYEVENTF_KEYUP, 0 '释放A键
'2
hwdeX = FindWindow(vbNullString, "Adobe Flash Player 13")
ret = PostMessage(hwdeX, WM_KEYDOWN, Value, 0&)
Sleep 200
ret = PostMessage(hwdeX, WM_UP, Value, 0&)
End Sub
可还是不能控制!还有什么办法?
上面两种方式都可以实现普通虚拟按键,都能对其他SWF进行控制,但是现在的是一个特殊的SWF文件,不知道作者在里面加入了什么判断,无法控制。文件地址:http://pan.baidu.com/s/14cJG6 展开
1个回答
展开全部
添加一个commandbutton,启动后点击command1激发事件
完整代码:
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Sleep (5000)
Shell "notepad", 1
Sleep (1000)
Call keybd_event(65, 0, 0, 0)
Sleep (2000)
Call keybd_event(66, 0, 0, 0)
Form1.SetFocus
End Sub
完整代码:
Option Explicit
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal Scan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Command1_Click()
Sleep (5000)
Shell "notepad", 1
Sleep (1000)
Call keybd_event(65, 0, 0, 0)
Sleep (2000)
Call keybd_event(66, 0, 0, 0)
Form1.SetFocus
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询