Пример #1
0
        public void ClickL(int x, int y)
        {
            UInt16 rrx = (UInt16)(x);
            UInt16 rry = (UInt16)(y);

            if (rrx < 0)
            {
                rrx = 0;
            }
            if (rry < 0)
            {
                rry = 0;
            }
            UInt32 pos = ((UInt32)rry << 16) | (UInt32)rrx;

            //IntPtr ph = p.MainWindowHandle;
            //IntPtr ph = (IntPtr)background_target_window_handle;

            //マウスメッセージを送り付けてみる
            SendMessageU(hWnd, (uint)WM.WM_MOUSEMOVE, new IntPtr((int)MK.None), new IntPtr(pos));
            WaitSleep.Do(100);
            SendMessageU(hWnd, (uint)WM.WM_LBUTTONDOWN, new IntPtr((int)MK.MK_LBUTTON), new IntPtr(pos));
            WaitSleep.Do(100);
            SendMessageU(hWnd, (uint)WM.WM_LBUTTONUP, new IntPtr((int)MK.None), new IntPtr(pos));
        }
Пример #2
0
        public void ClickLActive(int x, int y)
        {
            var rc = GetRectange();

            x += rc.X;
            y += rc.Y;

            WaitSleep.Do(100);
            SetCursorPos(x, y);                             // button2へ移動
            mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);  // マウスの左ボタンダウンイベントを発生させる
            WaitSleep.Do(100);
            SetCursorPos(x, y);                             // button2へ移動
            mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);    // マウスの左ボタンアップイベント
        }
Пример #3
0
        // 実行する
        static public System.Diagnostics.Process StartExe(string path, bool is_window_show = true)
        {
            var psi = new System.Diagnostics.ProcessStartInfo();

            psi.FileName         = path;
            psi.WorkingDirectory = CommonFiles.GetDirectory(path);

            var p = System.Diagnostics.Process.Start(psi);

            //p.WaitForInputIdle(); // 起動してアイドル状態になるまで待つ...と、処理を専有するのでReleaseでビルドすると動かなくなる...

            if (is_window_show)
            {
                while (!IsWindowVisible(p.MainWindowHandle)) // ウィンドウが表示されるまで待つ
                {
                    WaitSleep.Do(10);
                }
            }
            return(p);
        }
Пример #4
0
        public void MouseMove(int x, int y)
        {
            var rc = GetRectange();

            UInt16 rrx = (UInt16)(x + rc.X);
            UInt16 rry = (UInt16)(y + rc.Y);

            if (rrx < 0)
            {
                rrx = 0;
            }
            if (rry < 0)
            {
                rry = 0;
            }
            UInt32 pos = ((UInt32)rry << 16) | (UInt32)rrx;

            //IntPtr ph = p.MainWindowHandle;
            //IntPtr ph = (IntPtr)background_target_window_handle;

            //マウスメッセージを送り付けてみる
            SendMessageU(hWnd, (uint)WM.WM_MOUSEMOVE, new IntPtr((int)MK.None), new IntPtr(pos));
            WaitSleep.Do(100);
        }