Skip to content

Commit

Permalink
Properly set keyState array. This fixes Ctrl + Alt + Q for german key…
Browse files Browse the repository at this point in the history
…board layout

It now shows: Ctrl + Alt + Q (@)
  • Loading branch information
Phaiax committed May 5, 2024
1 parent c182d28 commit 6925f22
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions KeyNStroke/KeyboardHook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,24 +206,24 @@ private void FixKeyStateArray(KeyboardRawEventArgs e)
e.keyState[VK_SHIFT] = 129;
} else
{
e.keyState[VK_SHIFT] = 1;
e.keyState[VK_SHIFT] = 0;
}
return;
//return;
#pragma warning disable CS0162 // Unerreichbarer Code wurde entdeckt.
e.keyState[VK_CONTROL] = (byte)(e.Ctrl ? 129 : 1);
e.keyState[VK_CONTROL] = (byte)(e.Ctrl ? 129 : 0);
#pragma warning restore CS0162 // Unerreichbarer Code wurde entdeckt.
e.keyState[VK_MENU] = (byte)(e.Alt ? 129 : 1);
e.keyState[VK_CAPITAL] = (byte)(e.Caps ? 129 : 1);
e.keyState[VK_LWIN] = (byte)(e.LWin ? 129 : 1);
e.keyState[VK_RWIN] = (byte)(e.RWin ? 129 : 1);
e.keyState[VK_NUMLOCK] = (byte)(e.Numlock ? 129 : 1);
e.keyState[VK_SCROLL] = (byte)(e.Scrollock ? 129 : 1);
e.keyState[VK_LSHIFT] = (byte)(e.LShift ? 129 : 1);
e.keyState[VK_RSHIFT] = (byte)(e.RShift ? 129 : 1);
e.keyState[VK_LCONTROL] = (byte)(e.LCtrl ? 129 : 1);
e.keyState[VK_RCONTROL] = (byte)(e.RCtrl ? 129 : 1);
e.keyState[VK_LMENU] = (byte)(e.LAlt ? 129 : 1);
e.keyState[VK_RMENU] = (byte)(e.RAlt ? 129 : 1);
e.keyState[VK_MENU] = (byte)(e.Alt ? 129 : 0);
e.keyState[VK_CAPITAL] = (byte)(e.Caps ? 129 : 0);
e.keyState[VK_LWIN] = (byte)(e.LWin ? 129 : 0);
e.keyState[VK_RWIN] = (byte)(e.RWin ? 129 : 0);
e.keyState[VK_NUMLOCK] = (byte)(e.Numlock ? 129 : 0);
e.keyState[VK_SCROLL] = (byte)(e.Scrollock ? 129 : 0);
e.keyState[VK_LSHIFT] = (byte)(e.LShift ? 129 : 0);
e.keyState[VK_RSHIFT] = (byte)(e.RShift ? 129 : 0);
e.keyState[VK_LCONTROL] = (byte)(e.LCtrl ? 129 : 0);
e.keyState[VK_RCONTROL] = (byte)(e.RCtrl ? 129 : 0);
e.keyState[VK_LMENU] = (byte)(e.LAlt ? 129 : 0);
e.keyState[VK_RMENU] = (byte)(e.RAlt ? 129 : 0);
}

#endregion
Expand Down

0 comments on commit 6925f22

Please sign in to comment.