devxlogo

KeysPressed – Test the status of up to three keys

KeysPressed – Test the status of up to three keys

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As _    Integer' Return True if all the specified keys are pressed'' you can specify individual keys using VB constants, ' e.g. If KeysPressed(vbKeyControl, vbKeyDown) Then ...Function KeysPressed(ByVal KeyCode1 As KeyCodeConstants, _    Optional ByVal KeyCode2 As KeyCodeConstants, Optional ByVal KeyCode3 As _    KeyCodeConstants) As Boolean    If GetAsyncKeyState(KeyCode1) >= 0 Then Exit Function    If KeyCode2 = 0 Then KeysPressed = True: Exit Function    If GetAsyncKeyState(KeyCode2) >= 0 Then Exit Function    If KeyCode3 = 0 Then KeysPressed = True: Exit Function    If GetAsyncKeyState(KeyCode3) >= 0 Then Exit Function    KeysPressed = TrueEnd Function

See also  How to Avoid Money Transfer Scams  
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist