Beispiel #1
0
 bool IMessageFilter.PreFilterMessage(ref Message m)
 {
     if (this.ContainsFocus)
     {
         if (m.Msg == WM_KEYUP || m.Msg == WM_SYSKEYUP)
         {
             int scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
             InputApi.SetKeyState(scanCode, false);
         }
         else if (m.Msg == WM_SYSKEYDOWN || m.Msg == WM_KEYDOWN)
         {
             int scanCode = (Int32)(((Int64)m.LParam & 0x1FF0000) >> 16);
             InputApi.SetKeyState(scanCode, true);
         }
     }
     return(false);
 }
Beispiel #2
0
 private void SetMouseButtonState(MouseButtons pressedButtons)
 {
     InputApi.SetKeyState(LeftMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Left));
     InputApi.SetKeyState(RightMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Right));
     InputApi.SetKeyState(MiddleMouseButtonKeyCode, pressedButtons.HasFlag(MouseButtons.Middle));
 }