Register hotkey with down and up events? WM_HOTKEY?

Hi
Is there any way of register a hotkey with keydown and keyup events from the RegisterHotKey()?

Now it sends the WM_HOTKEY only when its pressed ones, but I also would like to get a msg when the key is released. couldn't find any on MSDN so using WM_HOTKEY is probably not a options?

How would I accomplish this? :/

EDIT: Using something like this is probably the best way:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
HHOOK hhkLowLevelKybd  = SetWindowsHookEx(WH_KEYBOARD_LL,LowLevelKeyboardProc, hThisInstance, 0);

LRESULT CALLBACK LowLevelKeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)
{
BOOL fEatKeystroke = FALSE;

  if (nCode == HC_ACTION) 
  {
     switch (wParam) 
	 {
		case WM_KEYDOWN:  
		case WM_SYSKEYDOWN:
		case WM_KEYUP:
		case WM_SYSKEYUP:
     }
  }
  return(fEatKeystroke ? 1 : CallNextHookEx(NULL, nCode, wParam,lParam));
}


Last edited on
Topic archived. No new replies allowed.