Agreed, it's not the most elegant code, but it's so short and simple I haven't bothered reorganizing the code yet. I probably will start adding features like re-bindable pause key, etc., and I will untangle the mess a bit at that time.
if (ForegroundWindow)
{
...
}
else
{
MessageBox(NULL, L"Unable to detect foreground window!", L"UniversalPauseButton Error", MB_OK | MB_ICONERROR);
}
becomes if (!ForegroundWindow)
{
MessageBox(NULL, L"Unable to detect foreground window!", L"UniversalPauseButton Error", MB_OK | MB_ICONERROR);
break;
}
...