[PastePlain]Prevent Windows start menu from activating (#31484)

This commit is contained in:
Laszlo Nemeth 2024-02-20 16:01:40 +01:00 committed by GitHub
parent 7c91dada64
commit 7df1049a54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -355,6 +355,13 @@ private:
try_inject_modifier_key_restore(inputs, VK_LMENU);
try_inject_modifier_key_restore(inputs, VK_RMENU);
// After restoring the modifier keys send a dummy key to prevent Start Menu from activating
INPUT dummyEvent = {};
dummyEvent.type = INPUT_KEYBOARD;
dummyEvent.ki.wVk = 0xFF;
dummyEvent.ki.dwFlags = KEYEVENTF_KEYUP;
inputs.push_back(dummyEvent);
auto uSent = SendInput(static_cast<UINT>(inputs.size()), inputs.data(), sizeof(INPUT));
if (uSent != inputs.size())
{