コード例 #1
0
        void HotKeyManager_RunXMove(object sender, MouseEventExtArgs e)
        {
            var hWnd    = WinApi.WindowFromPoint(e.Location);
            var hParent = IntPtr.Zero;

            if (hWnd == IntPtr.Zero)
            {
                return;
            }
            while (true)
            {
                hParent = WinApi.GetParent(hWnd);
                if (hParent == IntPtr.Zero)
                {
                    break;
                }
                hWnd = hParent;
            }
            if (!WinApi.IsWindow(hWnd))
            {
                return;
            }

            WinApi.RECT r = new WinApi.RECT();
            WinApi.GetWindowRect(hWnd, out r);
            offsetMoveWindow = new Point(e.X - r.Left, e.Y - r.Top);
            hWndMoveWindow   = hWnd;
            isXMove          = true;
        }
コード例 #2
0
        public static void MouseWheelToCursorPos(MouseEventExtArgs e, int mkKeyState = 0)
        {
            var hWnd   = WinApi.WindowFromPoint(e.Location);
            var wParam = (IntPtr)((e.Delta << 16) | mkKeyState);
            var lParam = (IntPtr)((e.X & 0xFFFF) | (e.Y << 16));

            WinApi.PostMessage(hWnd, WinApi.WM_MOUSEWHEEL, wParam, lParam);
        }
コード例 #3
0
        private static void HookManager_MouseMove(object sender, MouseEventArgs e)
        {
            var hWnd = WinApi.WindowFromPoint(e.Location);

            GetWindowInfo(hWnd);
        }