Link to home
Start Free TrialLog in
Avatar of arajoe
arajoe

asked on

Combo Keypress

How would I make an application recognize something like ctrl+shift + letter d? I know how to do it for one key but not a combination.
Avatar of List244
List244

Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Form1.Caption = GetKeyState(vbKeyControl)
If GetKeyState(vbKeyShift) < 0 And GetKeyState(vbKeyControl) < 0 And GetKeyState(vbKeyD) < 0 Then
    MsgBox "Shift + Control + D"
End If
End Sub
ASKER CERTIFIED SOLUTION
Avatar of List244
List244

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arajoe

ASKER

Sorry its not for a combo but a form in general. I meant a combination of buttons. What I want to do is hit cont shift d and bring the application into debug mode.
Avatar of arajoe

ASKER

got it with that code. just put it into the forms keypress.
Arajoe, that first example will catch Control + Shift + D, where I do my message box, you should put the code you want.