Declare Function GetKeyState Lib "user32.dll"(ByVal nVirtKey As Long) As IntegerSub keycodes()Dim x As Longx = GetKeyState(&HD) ' Enter's virtual key code is &H0DIf (x And &H80 展开
Declare Function GetKeyState Lib "user32.dll"(ByVal nVirtKey As Long) As IntegerSub keycodes()Dim x As Longx = GetKeyState(&HD) ' Enter's virtual key code is &H0DIf (x And &H80) = &H80 Then ' check to see if it is toggledDebug.Print "Enter is currently toggled."End IfIf (x And &H1) = &H1 Then ' check to see if it is depressedDebug.Print "Enter is currently depressed."End IfEnd Sub 收起