Send undefined keystroke instead of Ctrl to suppress the start menu.

This commit is contained in:
Bartosz Sosnowski
2019-10-18 09:32:58 +02:00
committed by Bartosz Sosnowski
parent e1d5dd263a
commit 68d3450ff4

View File

@@ -22,11 +22,15 @@ bool TargetState::signal_event(unsigned vk_code, bool key_down) {
lock.unlock();
cv.notify_one();
if (supress) {
// Send a fake key-stroke to prevent the start menu from appearing.
// We use 0x07 VK code, which is undefined. It still prevents the
// start menu from appearing, but should not interfere with any
// keyboard shortcuts.
INPUT input[3] = { {},{},{} };
input[0].type = INPUT_KEYBOARD;
input[0].ki.wVk = VK_CONTROL;
input[0].ki.wVk = 0x07;
input[1].type = INPUT_KEYBOARD;
input[1].ki.wVk = VK_CONTROL;
input[1].ki.wVk = 0x07;
input[1].ki.dwFlags = KEYEVENTF_KEYUP;
input[2].type = INPUT_KEYBOARD;
input[2].ki.wVk = VK_LWIN;