RegisterHotKey

Is there a way to register a double press of a key with registerhotkey?

If not, whats the best way to catch a double press?
Im thinking registerhotkey, catch the event, and save what key was pressed at what time, if shortly after the same event is recieved, its should be a double key press

also, is there a way to know when a key has been pressed without using registerhotkey? because registerhotkey seems to disable the key press events for all other programs
Last edited on
also, is there a way to know when a key has been pressed without using registerhotkey?

Yes. When you press a key, WM_CHAR message ( http://msdn.microsoft.com/en-us/library/ms646276(VS.85).aspx ) is sent to your program
Last edited on
Forgot to say, that the application will not have keyboard focus =P

Also, is it possible to know if a numpad key is being pressed without numlock on?
Yesterday i did some testing with RegisterHotKey, and i only got the numpad to work(only recieved WM_HOTKEY messages), when numlock was on

(Im trying to turn the numpad on my laptop into something useful)
Last edited on
Also, is it possible to know if a numpad key is being pressed without numlock on?

You can check if numlock is on yourself:
1
2
3
4
5
6
7
8
9
SHORT state=GetKeyState(VK_NUMLOCK);
if(state==TRUE)
  {
    std::cout <<"Numlock is ON "<<std::endl;
  }
else
  {
    std::cout <<"Numlock is OFF"<<std::endl;
  }


Maybe you want to use keyboard hooks?
http://www.cplusplus.com/forum/windows/26249/


Also, is it possible to know if a numpad key is being pressed without numlock on?

You can check if numlock is on yourself:
I know how to check if numlock is on, the problem is that with RegisterHotKey the app would only recieve the hotkey messages if numlock was on, so numlock somehow disabled the numpad completely

And thanks for the keyboard hook idea ill try it out asap when i get home ^^
Last edited on
Topic archived. No new replies allowed.