按键_精灵吧 关注:12贴子:201
  • 0回复贴,共1

通过win32api,获取指定按键的状态  kingjin_

只看楼主收藏回复

通过win32api,获取指定按键的状态
kingjin_1234:
win32api:
Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
参数:左键 VK_LBUTTON
右键 VK_RBUTTON
返回值等于1 说明键已经被按过并且当前是松开的状态
返回值等于0 说明键是松开的状态
返回值等于- 32767 说明键是按下的状态
返回值等于32768 说明键是按住的状态
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Do
x = GetAsyncKeyState(114)
Select Case x
Case 1
TracePrint "按了一次F3"
Case 0
TracePrint "没按住F3"
Case - 32767
TracePrint "按住了F3"
End Select
Delay 1000
Loop


IP属地:广东来自Android客户端1楼2022-03-09 11:48回复