利用VB如何模拟键盘 按键
我的目的是每间隔10分钟就运行一下cirl+alt+vVB可以办到骂??按钮的代码哦~~~谢谢大家帮忙了代码有误!!!!!!!!!!!!!!!!!!!!!!!!!!!!!...
我的目的是
每间隔 10分钟就 运行一下cirl+alt+v
VB可以办到骂??
按钮的代码哦~~~
谢谢大家帮忙了
代码有误!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 展开
每间隔 10分钟就 运行一下cirl+alt+v
VB可以办到骂??
按钮的代码哦~~~
谢谢大家帮忙了
代码有误!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 展开
2个回答
展开全部
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
'按下回车
Call keybd_event(13, 0, 0, 0)
'抬起回车
Call keybd_event(13, 0, 2, 0)
13是回车键的keycode,改成其他也一样
在vb里有一套key常量,比如vbKeyA 就是A键
keybd_event vbKeyA,0,0,0 就是按下A
完整代码:在窗体上放一个Timer,interval设成1000
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
dim delay as long
private sub form_load()
delay=600
end sub
Private sub Timer1_Timer()
if delay>0 then
delay=delay-1
else
keybd_event vbkeycontrol,0,0,0
keybd_event vbkeymenu,0,0,0
keybd_event vbkeyV,0,0,0
doevents
doevents
keybd_event vbkeyV,0,2,0
keybd_event vbkeymenu,0,2,0
keybd_event vbkeycontrol,0,2,0
delay=600
end if
end sub
'按下回车
Call keybd_event(13, 0, 0, 0)
'抬起回车
Call keybd_event(13, 0, 2, 0)
13是回车键的keycode,改成其他也一样
在vb里有一套key常量,比如vbKeyA 就是A键
keybd_event vbKeyA,0,0,0 就是按下A
完整代码:在窗体上放一个Timer,interval设成1000
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
dim delay as long
private sub form_load()
delay=600
end sub
Private sub Timer1_Timer()
if delay>0 then
delay=delay-1
else
keybd_event vbkeycontrol,0,0,0
keybd_event vbkeymenu,0,0,0
keybd_event vbkeyV,0,0,0
doevents
doevents
keybd_event vbkeyV,0,2,0
keybd_event vbkeymenu,0,2,0
keybd_event vbkeycontrol,0,2,0
delay=600
end if
end sub
微测检测5.10
2023-05-10 广告
2023-05-10 广告
您好!建议咨 深圳市微测检测有限公司,已建立起十余个专业实验室,企业通过微测检测就可以获得一站式的测试与认 证解决方案;(EMC、RF、MFi、BQB、QI、USB、安全、锂电池、快充、汽车电子EMC、汽车手机互 联、语音通话质量),认证遇...
点击进入详情页
本回答由微测检测5.10提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询