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 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()); }
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()); }