Почему горячая клавиша не работает? C++

В коде ниже почему-то msg никак не хочет получать айди горячей клавиши (Registehotkey возвращает 1)

#include <iostream>
#include <Windows.h>
#include <thread>

using namespace std;

MSG msg;

void main()
{
    RegisterHotKey(0, 100, MOD_NOREPEAT, VK_XBUTTON1); // тут возвращает true
    while (true)
    {
        GetMessage(&msg, 0, 0, 0);
        if (msg.message == WM_HOTKEY)
        {
            if (msg.wParam == 100)
            {
                while (msg.wParam == 100 && msg.message == WM_HOTKEY)
                {
                    keybd_event(' ', 0, 0, 0);
                    keybd_event(' ', 0, KEYEVENTF_KEYUP, 0);
                }
            }
        }
    }


    system("PAUSE");
    return;
}


Ответы (0 шт):