Exemple #1
0
 private int LLMouseProc(int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (Imports.IsKeyDown(Keys.F12))
     {
         return(MouseHook.CallNextHookEx(this.mousehookId, nCode, wParam, lParam));
     }
     MouseHook.MSLLHOOKSTRUCT mSLLHOOKSTRUCT = (MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT));
     try
     {
         if (this.mouseEvent((MouseEventID)((int)wParam), mSLLHOOKSTRUCT.pt.x, mSLLHOOKSTRUCT.pt.y))
         {
             return(1);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine("Error in mousehook " + ex.Message);
     }
     return(MouseHook.CallNextHookEx(this.mousehookId, nCode, wParam, lParam));
 }
Exemple #2
0
 public override void OnEnable()
 {
     this.bounds = new Rect(0, 0, 256, 32);
     this.CreateButtons();
     this.hook = new MouseHook(new MouseHook.MouseEvent(this.OnMouseEvent));
 }
Exemple #3
0
 public void Dispose()
 {
     MouseHook.UnhookWindowsHookEx(this.mousehookId);
 }
Exemple #4
0
 public MouseHook(MouseHook.MouseEvent callback)
 {
     this.mouseEvent  = callback;
     this.LLHookProc  = new MouseHook.HookProc(this.LLMouseProc);
     this.mousehookId = MouseHook.SetWindowsHookEx(14, this.LLHookProc, IntPtr.Zero, 0);
 }