So, I am trying to write a program that detects when the keycombination Control + C is pressed, I have read that the best way to do this is to use RegisterHotKey(). I have never used this before though so I am a little confused since my code isnt working. This is the solution I found online but it doesn't work. I have looked at the documentation but that hasn't helped either. this is my code:
AutoClicker::AutoClicker()
{
clicker = std::thread(&AutoClicker::Clicker, this);
enum {KEY_C = 1};
RegisterHotKey(0, KEY_C, MOD_CONTROL, 0x5A);
MSG msg;
while (GetMessage(&msg, 0, 0, 0)) {
PeekMessage(&msg, NULL, 0, 0, 0);
switch (msg.message)
{
case WM_HOTKEY:
if (msg.wParam == KEY_C)
{
printf("1 Pressed");
}
}
}
}