Detect keypress outside of program
[Originally posted by Erik L.]
I have a problem... I want to be able to detect a keypress outside of my own program. If my program's minimized and the user presses F12 for instance, my program should go to normal state or something like that.
Re:Detect keypress outside of program
[Originally posted by Mikekay2]
Use the GetAsyncKeystate function:
Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
If the function succeeds, the return value specifies whether the key was pressed since the last call to GetAsyncKeyState, and whether the key is currently up or down. If the most significant bit is set, the key is down, and if the least significant bit is set, the key was pressed after the previous call to GetAsyncKeyState. The return value is zero if a window in another thread or process currently has the keyboard focus.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center