|
-
Nov 14th, 2002, 03:01 PM
#1
Thread Starter
Addicted Member
Windows key???*RESOLVED*
Is there a way to detect if the windows key has been pressed, I cant find any keyconstants for it anywhere??? And would I be right in ausumming that XP comes with all the API's the 95 systems and upwards had???
Thanks.
Last edited by ben1523; Nov 14th, 2002 at 03:57 PM.
-
Nov 14th, 2002, 03:37 PM
#2
VB Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 91 Then
Debug.Print "Left Windows Key"
ElseIf KeyCode = 92 Then
Debug.Print "Right Windows Key"
End If
End Sub
-
Nov 14th, 2002, 03:46 PM
#3
Thread Starter
Addicted Member
Thanks a lot, but in would a form_keypress event catch the button, because the form would be deselected???
-
Nov 14th, 2002, 03:57 PM
#4
Ah, you never mentioned that you wanted to capture key stokes
when not in your application, try:
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
If GetAsyncKeyState(91) <> 0 Then
Debug.Print "Left Windows Key"
ElseIf GetAsyncKeyState(92) <> 0 Then
Debug.Print "Right Windows Key"
End If
End Sub
-
Nov 14th, 2002, 03:58 PM
#5
Thread Starter
Addicted Member
Thanks, just what I need.
-
Nov 14th, 2002, 04:32 PM
#6
Hyperactive Member
You've almost given me what I need. I can get the keycode for the ctrl keys and the enter keys but how do I read WHICH ctrl key has been pressed and WHICH enter key has been pressed as they will perform different functions in my program.
Thanks,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|