Adding a System wide Hot Key in Win32


ATOM hotkeyID = GlobalAddAtom(_T("MyHotKeyCombination"));

if(!UnregisterHotKey(hWnd,hotkeyID))
{
   if (RegisterHotKey( hWnd, hotkeyID, MOD_ALT, 0x42))  //0x42 is 'b'
   {
       _tprintf(_T("Hotkey 'Alt+b' registered \n"));
   }
}
Handle the WM_HOTKEY message in WndProc
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    int wmId, wmEvent;
    PAINTSTRUCT ps;
    HDC hdc;

    switch (message)
    {
    case WM_HOTKEY:
        {
            _tprintf(_T("WM_HOTKEY received\n"));
        }
        break;
    case WM_COMMAND:

.....