|
-
Jan 23rd, 2001, 06:25 AM
#1
Thread Starter
New Member
I have a number of "special" rubber shortcut keys on my keyboard. Can VB catch these when they are pressed? Windows2k doesn't support the software that came with it and I'd like to make a replacement.
Win2k does however support the Volume/Mute buttons for some reason..? But no OSD obviously 
«davidc»
-
Jan 23rd, 2001, 07:35 AM
#2
To capture keys, use the GetAsyncKeyState API function.
Code:
Private Declare Function GetAsyncKeyState _
Lib "user32.dll" (ByVal vKey As Long) As Integer
Privatei Sub Timer1_Timer()
Dim iKey As Integer
For iKey = 3 to 255
If GetAsyncKeyState(iKey) Then Caption = Chr(iKey)
Next iKey
End Sub
-
Jan 23rd, 2001, 11:48 AM
#3
Thread Starter
New Member
Thanks... I'll give it a go!
«davidc»
-
Jan 23rd, 2001, 05:24 PM
#4
Thread Starter
New Member
Eeeerrrkkk!
OK, so that works fine barr 3 buttons. I have modified the code slightly so that it doesn't convert it to an ASCII code, as I'd like my program to check against a table of numbers.
However, there are three buttons at the top right which are playing up. One is HK2 (a hotkey), the second is COFFEE BREAK (screensaver) and the third is Menu/i (Originally an F1 help style thing)
Two of these buttons are the ones I am trying to catch.. and all three return 255 as a keycode..! I'm sensing something strange going on. Increasing the loop to 300 doesn't make a difference (I didn't think it would sadly!). So how can I distinguish between these keys? It must be possible, as the software which shipped with the keyboard originally managed somehow!
Thanks again,
«davidc»
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
|