Solved

Combo Keypress

Posted on 2006-06-14
5
173 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 250 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

828 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