Results 1 to 6 of 6

Thread: Windows key???*RESOLVED*

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    153

    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.

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    VB Code:
    1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    2.   If KeyCode = 91 Then
    3.     Debug.Print "Left Windows Key"
    4.   ElseIf KeyCode = 92 Then
    5.     Debug.Print "Right Windows Key"
    6.   End If
    7. End Sub

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    153
    Thanks a lot, but in would a form_keypress event catch the button, because the form would be deselected???

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Ah, you never mentioned that you wanted to capture key stokes
    when not in your application, try:
    VB Code:
    1. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    2.  
    3. Private Sub Form_Load()
    4.   Timer1.Interval = 100
    5. End Sub
    6.  
    7. Private Sub Timer1_Timer()
    8.   If GetAsyncKeyState(91) <> 0 Then
    9.     Debug.Print "Left Windows Key"
    10.   ElseIf GetAsyncKeyState(92) <> 0 Then
    11.     Debug.Print "Right Windows Key"
    12.   End If
    13. End Sub

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Posts
    153
    Thanks, just what I need.

  6. #6
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424
    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
  •  



Click Here to Expand Forum to Full Width