public void Start() { _mainThreadNativeId = Native.GetCurrentThreadId(); //Paused = false; _mouseHook.Install(); Native.MSG msg; while (Native.GetMessage(out msg, IntPtr.Zero, (uint)WM.WM_USER, (uint)WM.PAUSE_RESUME) > 0) { var m = (WM)msg.message; UpdateContextAndEventArgs(); switch (m) { case WM.GESTBTN_DOWN: OnMouseDown(); break; case WM.GESTBTN_MOVE: OnMouseMove(); break; case WM.GESTBTN_MODIFIER: OnModifier((GestureModifier)msg.wParam.ToInt32()); break; case WM.GESTBTN_UP: OnMouseUp(); break; case WM.STAY_TIMEOUT: OnTimeout(); break; case WM.PAUSE_RESUME: var pause = (msg.wParam.ToInt32() == 1); OnPauseResume(pause); break; case WM.STOP: OnStop(); return; } } }
public Win32MousePathTracker2() { //properties defaults //GestureButton = GestureButtons.RightButton; InitialValidMove = 10; InitialStayTimeout = true; InitialStayTimeoutMillis = 150; EffectiveMove = 20; StayTimeout = false; PerformNormalWhenTimeout = false; _mouseHook = new MouseHook(); _mouseHook.MouseHookEvent += HookProc; //_mouseHook.GotMessage += HookGotMessage; #if DEBUG _monitoringHook.MouseHookEvent += args => { //Debug.Write("M"); }; _monitoringHook.Install(); #endif }