コード例 #1
0
ファイル: Form1.cs プロジェクト: marionette-of-u/RevText
 public static void KeyboardHookedEventHandler1(object sender, KeyboardHookedEventArgs e)
 {
     if (e.UpDown == KeyboardUpDown.Down)
     {
         keyFlags[e.KeyCode] = true;
     }
     else
     {
         keyFlags.Remove(e.KeyCode);
     }
     if (Clipboard.ContainsText() && (keyFlags.Contains(Keys.LControlKey) || keyFlags.Contains(Keys.RControlKey)) && keyFlags.Contains(Program.hotKey))
     {
         e.Cancel = Program.through;
         Clipboard.SetDataObject(Program.RevProc(Clipboard.GetText()), true);
     }
 }
コード例 #2
0
 private int CallNextHook(int code, KeyboardMessage message, ref KeyboardState state)
 {
     if (code >= 0)
     {
         KeyboardHookedEventArgs e = new KeyboardHookedEventArgs(message, ref state);
         OnKeyboardHooked(e);
         if (e.Cancel)
         {
             return -1;
         }
     }
     return CallNextHookEx(IntPtr.Zero, code, message, ref state);
 }
コード例 #3
0
 ///<summary>
 ///KeyboardHookedイベントを発生させる。
 ///</summary>
 ///<param name="e">イベントのデータ。</param>
 protected virtual void OnKeyboardHooked(KeyboardHookedEventArgs e)
 {
     KeyboardHookedEventHandler handler = base.Events[EventKeyboardHooked] as KeyboardHookedEventHandler;
     if (handler != null)
         handler(this, e);
 }