Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Combo Keypress

Posted on 2006-06-14
5
Medium Priority
?
210 Views
Last Modified: 2010-04-30
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.
0
Comment
Question by:arajoe
  • 3
  • 2
5 Comments
 
LVL 8

Expert Comment

by:List244
ID: 16904109
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
0
 
LVL 8

Accepted Solution

by:
List244 earned 1000 total points
ID: 16904120
Or better fit for a combo:

Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If GetKeyState(vbKeyShift) < 0 And GetKeyState(vbKeyControl) < 0 And GetKeyState(vbKeyD) < 0 Then
    MsgBox "Shift + Control + D"
End If
End Sub
0
 

Author Comment

by:arajoe
ID: 16904193
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.
0
 

Author Comment

by:arajoe
ID: 16904202
got it with that code. just put it into the forms keypress.
0
 
LVL 8

Expert Comment

by:List244
ID: 16904205
Arajoe, that first example will catch Control + Shift + D, where I do my message box, you should put the code you want.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question