I saw in the source code you use GetAsyncKey, which is fine.
However, you have to check for these dead keys:
WinUser.h
#define VK_LSHIFT 0xA0
#define VK_RSHIFT 0xA1
#define VK_LCONTROL 0xA2
#define VK_RCONTROL 0xA3
#define VK_LMENU 0xA4
#define VK_RMENU 0xA5
On line 1040 you check whether you found the pressed key (actually the released key, which is good):
if(keyUpTrig[i] && clickedOnceForTriggerFlag)
if (waitingForTrigger)
{
_itoa_s(i, triggerText, 4, 10);
SetFocus(outputWindow);
SetDlgItemText(hWnd, GetDlgCtrlID(triggerButton), triggerText);
my_trigger_key = atoi(triggerText);
char winTxt[1024];
memset(winTxt, 0, 1024);
GetWindowText(triggerButton2, winTxt, 1024);
my_trigger_key2 = atoi(winTxt);
SetWindowTextA(press, string_format("press (clicking while: key <%d> keeps hit down)", my_trigger_key).c_str());
SetWindowTextA(toggle, string_format("toggle (clicking begin: hit <%d>, end: hit <%d>)", my_trigger_key, my_trigger_key2).c_str());
waitingForTrigger = false;
}
Unfortunately, you forget to also store the dead key states so that it's possible to start or end the clicking with for instance <LCTRL+1>.