예제 #1
0
        public static void Stop()
        {
            if (_mouseHookId != 0)
            {
                Win32APIs.UnhookWindowsHookEx(_mouseHookId);

                _mouseHookId = 0;
            }
        }
예제 #2
0
        public static void Start(HookProc mouseHookProc)
        {
            if (_mouseHookId != 0)
            {
                return;
            }

            _mouseHookProc = mouseHookProc;
            _mouseHookId   = Win32APIs.SetWindowsHookEx(WH_CALLWNDPROC, _mouseHookProc, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);

            if (_mouseHookId == 0)
            {
                Stop();
            }
        }
예제 #3
0
 public static int CallNextHookEx(int code, Int32 wParam, IntPtr lParam)
 {
     return(Win32APIs.CallNextHookEx(_mouseHookId, code, wParam, lParam));
 }