Esempio n. 1
0
 private IntPtr HookFunc(int nCode, IntPtr wParam, IntPtr lParam)
 {
     if (nCode >= 0)
     {
         // ISSUE: reference to a compiler-generated field
         if (513 == (int)wParam && this.LeftButtonDown != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.LeftButtonDown((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
         // ISSUE: reference to a compiler-generated field
         if (514 == (int)wParam && this.LeftButtonUp != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.LeftButtonUp((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
         // ISSUE: reference to a compiler-generated field
         if (516 == (int)wParam && this.RightButtonDown != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.RightButtonDown((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
         // ISSUE: reference to a compiler-generated field
         if (517 == (int)wParam && this.RightButtonUp != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.RightButtonUp((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
         // ISSUE: reference to a compiler-generated field
         if (512 == (int)wParam && this.MouseMove != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.MouseMove((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
         // ISSUE: reference to a compiler-generated field
         if (522 == (int)wParam && this.MouseWheel != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.MouseWheel((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
         // ISSUE: reference to a compiler-generated field
         if (515 == (int)wParam && this.DoubleClick != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.DoubleClick((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
         // ISSUE: reference to a compiler-generated field
         if (519 == (int)wParam && this.MiddleButtonDown != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.MiddleButtonDown((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
         // ISSUE: reference to a compiler-generated field
         if (520 == (int)wParam && this.MiddleButtonUp != null)
         {
             // ISSUE: reference to a compiler-generated field
             this.MiddleButtonUp((MouseHook.MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MouseHook.MSLLHOOKSTRUCT)));
         }
     }
     return(MouseHook.CallNextHookEx(this.hookID, nCode, wParam, lParam));
 }
Esempio n. 2
0
 private IntPtr SetHook(MouseHook.MouseHookHandler proc)
 {
     using (ProcessModule mainModule = Process.GetCurrentProcess().MainModule)
         return(MouseHook.SetWindowsHookEx(14, proc, MouseHook.GetModuleHandle(mainModule.ModuleName), 0U));
 }