Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Combo Keypress

Posted on 2006-06-14
5
Medium Priority
?
203 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…
Suggested Courses

688 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