Hi all,
Does anyone know how to implement a Boss Key? I want to register a global (operating system) shortcut (e.g. Alt + Ctrl + F10 )for reacting with my code regardless the game window is hidden ,Minimized, una-active , just like the unreal editor shortcut for LiveCoding (Alt + Ctrl + F11 ).
I have tried a console app that worked as intent :
#include <iostream>
#include <windows.h>
int main(
int argc,
TCHAR* argv[])
{
if (RegisterHotKey(
NULL,
1, // id: 0x0000 ~ 0xBFFF for app, 0xC000 ~ 0xFFFF for dll ,
MOD_ALT | MOD_CONTROL | MOD_NOREPEAT,
0x70)) //0x70 is 'F10'
{
std::cout << ( "Hotkey 'ALT+Ctrl+F10' registered, using MOD_NOREPEAT flag.\n");
}
MSG msg = { 0 };
while (GetMessage(&msg, NULL, 0, 0) != 0)
{
if (msg.message == WM_HOTKEY)
{
std::cout << ("WM_HOTKEY received!!\n");
}
}
return 0;
}
I have tried all RegisterHotKey() in my c++ code and I could register this hotkey successfully ,
but I don’t know where to place the GetMessage() method for polling WM_HOTKEY event from the main game message loop (game thread).
Is my approach wrong or is there another way to implement this functionality?
thanks