vb 从零开始(三)
躲避了np的扫描现在就可以模拟了!
--------------------------------------------------------------------------------------------------------------------------------------------------------
需要vbapi函数:
keybd_event←函数模拟了键盘行动
--------------------------------------------------------------------------------------------------------------------------------------------------------
相关api声明:
keybd_event
privatedeclaresubkeybd_eventlib"user32"(byvalbvkbyte,byvalscanbyte,byvaldwflagslong,byvaldwextrainfolong)
--------------------------------------------------------------------------------------------------------------------------------------------------------
需要的控件:timer(interval不为空)
--------------------------------------------------------------------------------------------------------------------------------------------------------
代码:
privatedeclaresubkeybd_eventlib"user32"(byvalbvkbyte,byvalscanbyte,byvaldwflagslong,byvaldwextrainfolong)
privatesubtimer1_timer
callkeybd_event(82,0,0,0)'模拟按下"r"键
endsub
--------------------------------------------------------------------------------------------------------------------------------------------------------
其它模拟:
方法一:
appactivatestitle
sendkeys"5"
方法二:
appactivatestitle
sendkeysvbkey5
方法三:
sendmessagehwnd,wm_keydown,vbkey5,0&
sendmessagehwnd,wm_keyup,vbkey5,0&
方法四:
appactivatestitle
keybd_event53,0,0,0
keybd_event53,0,keyeventf_keyup,0
方法五:
postmessagelhwnd,wm_keydown,vbkey5,0&
postmessagelhwnd,wm_keyup,vbkey5,0&