private void WindowMovedMethod(IntPtr hWndEventHook, NativeMethods.SWEH_Events eventType, IntPtr hWnd, NativeMethods.SWEH_ObjectId objID, long idChild, uint dwEventThread, uint dwmsEventTime) { Debug.WriteLine("A window has been moved"); movedWindow.SetOutput(new Window.Window { hWnd = hWnd }); Trigger?.Invoke(this, new EventArgs()); }
public static IntPtr WinEventHookRange( NativeMethods.SWEH_Events eventFrom, NativeMethods.SWEH_Events eventTo, WinEventDelegate eventDelegate, uint idProcess, uint idThread) { // new UIPermission(UIPermissionWindow.AllWindows).Demand(); return(NativeMethods.SetWinEventHook( eventFrom, eventTo, IntPtr.Zero, eventDelegate, idProcess, idThread, NativeMethods.WinEventHookInternalFlags)); }
protected static void WinEventCallback(IntPtr hWinEventHook, NativeMethods.SWEH_Events eventType, IntPtr hWnd, NativeMethods.SWEH_ObjectId idObject, long idChild, uint dwEventThread, uint dwmsEventTime) { // 游戏窗口获取焦点时会调用 //if (hWnd == GameInfo.Instance.hWnd && // eventType == Hook.SWEH_Events.EVENT_OBJECT_FOCUS) //{ // log.Info("Game window get foucus"); //} // Update game's position infomation if (hWnd == gameHWnd && eventType == NativeMethods.SWEH_Events.EVENT_OBJECT_LOCATIONCHANGE && idObject == (NativeMethods.SWEH_ObjectId)NativeMethods.SWEH_CHILDID_SELF) { UpdateLocation(); } }
private void WindowMoved(IntPtr hWndEventHook, NativeMethods.SWEH_Events eventType, IntPtr hWnd, NativeMethods.SWEH_ObjectId objID, long idChild, uint dwEventThread, uint dwmsEventTime) { ArrangementChanged(); Trigger?.Invoke(this, new EventArgs()); }
public static extern IntPtr SetWinEventHook(NativeMethods.SWEH_Events eventMin, NativeMethods.SWEH_Events eventMax, IntPtr hmodWinEventProc, NativeMethods.WinEventDelegate lpfnWinEventProc, uint idProcess, uint idThread, NativeMethods.SWEH_dwFlags dwFlags);