Getting and displaying the byte value of a key pressed
Posted on 2004-09-02
I have been looking all over for an answer to this problem i am having...
I need my program to listen for the key that is being pressed, the byte value (ex. &H26 -- the down arrow) and display that on the screen (the &H26). Basically, this program has a button the user can click, it will pop up a window that says press a key, they press a key, it displays the key, and then they click close. Then the application will repeat the key that was pressed (programmitcally). I have the sending of the key programmitcally working, but as you can see the key is hard coded in (&H26).
Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
'Send the key press
keybd_event(&H26, 0, 0, 0)
How can i get this number (&H26) when the user presses a key?
Thanks in advance,