Custom Global Hotkey Win32 C - Problem

Posted by UK on Stack Overflow See other posts from Stack Overflow or by UK
Published on 2010-04-04T07:50:12Z Indexed on 2010/04/04 7:53 UTC
Read the original article Hit count: 155

Filed under:
|
|
|

Hello ,

I am trying to get the user defined global hot key for my application. Here is my application code,

user.rc

CONTROL         "", IDC_MHOTKEY, HOTKEY_CLASS, WS_TABSTOP, 91, 86, 68, 14

function.cpp

    WORD wHotKey = SendDlgItemMessage(hwnd, IDC_MHOTKEY, HKM_GETHOTKEY, 0, 0);
    GLOBAL_HOTKEY= wHotKey;
    RegisterHotKey ( NULL, TURN_OFF_HOTKEY, HIBYTE(LOWORD(wHotKey)) , wHotKey);

main.cpp

   if ( messages.message == WM_HOTKEY && ( HIWORD ( messages.lParam ) == GLOBAL_HOTKEY) )
                        alert("Coming only for Single Key");

This code works well, Only If the user selects a single key and not working when he selects multiple key combined like CTRL+F8.

I know I am doing something wrong here. Really appreciate If someone guide me in a right path.

© Stack Overflow or respective owner

Related posts about win32

Related posts about c