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&