Skip to content

Commit

Permalink
[PastePlain]Prevent Windows start menu from activating (microsoft#31484)
Browse files Browse the repository at this point in the history
  • Loading branch information
donlaci committed Feb 20, 2024
1 parent 7c91dad commit 7df1049
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/modules/pasteplain/PastePlainModuleInterface/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,13 @@ class PastePlain : public PowertoyModuleIface
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())
{
Expand Down

0 comments on commit 7df1049

Please sign in to comment.