From 7df1049a547e6e496ca787c7d56252f9424906dd Mon Sep 17 00:00:00 2001 From: Laszlo Nemeth <57342539+donlaci@users.noreply.github.com> Date: Tue, 20 Feb 2024 16:01:40 +0100 Subject: [PATCH] [PastePlain]Prevent Windows start menu from activating (#31484) --- .../pasteplain/PastePlainModuleInterface/dllmain.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/modules/pasteplain/PastePlainModuleInterface/dllmain.cpp b/src/modules/pasteplain/PastePlainModuleInterface/dllmain.cpp index 32da5d0f4b..ba463b3718 100644 --- a/src/modules/pasteplain/PastePlainModuleInterface/dllmain.cpp +++ b/src/modules/pasteplain/PastePlainModuleInterface/dllmain.cpp @@ -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(inputs.size()), inputs.data(), sizeof(INPUT)); if (uSent != inputs.size()) {