コード例 #1
0
        public static void ActivateMenuItem(string mainWndClass, int menuItemNum, int menuSubItemNum)
        {
            IntPtr hWnd  = new WndFinder().GetWindow(mainWndClass);
            IntPtr hMenu = GetSubMenu(GetMenu(hWnd), menuItemNum);

            SendMessage(hWnd, WM_INITMENU, (int)hMenu, 0);
            SendMessage(hWnd, WM_INITMENUPOPUP, (int)hMenu, 0);

            SendMessage(hWnd, WM_COMMAND, GetMenuItemID(hMenu, menuSubItemNum), 0);
        }
コード例 #2
0
        public static void CommandWithClick(string wndClass, int width, int height, double xFactor, double yFactor)
        {
            WndFinder wf   = new WndFinder();
            IntPtr    hWnd = wf.GetWindow(wndClass);

            if (hWnd != IntPtr.Zero)
            {
                SetWindowPos(hWnd, /*HWND_TOPMOST*/ (IntPtr)(-1), 0, 0, width, height, SetWindowPosFlags.ShowWindow);
                int x = (int)(width * xFactor);
                int y = (int)(height * yFactor);
                MouseLeftClick(x, y);
            }
        }
コード例 #3
0
        private void RecordVoiceSet(int startVoiceIdOfScene, int numberOfVoicesAvailable, int currentBatchStartId, Action missionLoadAction, Action activationAction)
        {
            ISOModifier.PrepareNextBatch(startVoiceIdOfScene, currentBatchStartId, numberOfVoicesAvailable);
            pcsx2Process = StartPcsx2();
            pcsx2Process.WaitForInputIdle();
            emulatorWindow = pcsx2Process.MainWindowHandle;
            //Wait for the emulator to load the main screen...
            WaitSeconds(12);
            emulatorViewPortWindow = WndFinder.SearchForWindow("wxWindowNR", "Slot");
            this.inputImpersonator = new InputImpersonator(emulatorViewPortWindow);

            this.inputImpersonator.SelectFrenchLanguage();
            missionLoadAction.Invoke();
            StartRecorder(currentBatchStartId, numberOfVoicesAvailable);
            WindowReorganizer.SetActiveWindow(emulatorViewPortWindow);
            activationAction.Invoke();
        }
コード例 #4
0
ファイル: WindowManager.cs プロジェクト: oxyflour/old-repos
        public int executeMoveToGroup(String file, String directory, int index, bool move)
        {
            RegistryKey rk = getRegKey();
            verifyRegConfig(rk);
            int current = (int)rk.GetValue("index", 0);
            int max = (int)rk.GetValue("maxIndex");
            if (index < 0 || index >= max) index = current;

            ProcessStartInfo si = new ProcessStartInfo();
            si.FileName = file;
            si.WorkingDirectory = directory;
            si.WindowStyle = (move || index == current) ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden;
            Process proc = Process.Start(si);
            if (proc == null) return 0;

            int wndCount = 0;
            WndFinder wf = new WndFinder(new List<int>(), proc.Id);
            for (int i = 0; i < 20; i ++) {
                Thread.Sleep(200);
                wf.wndList.Clear();
                object wfRef = wf;
                EnumDesktopWindows(IntPtr.Zero, new EnumCallback(FindExecWindow), ref wfRef);
                if (proc.HasExited) break;
                if (wf.wndList.Count > 0 && wf.wndList.Count == wndCount) break;
                wndCount = wf.wndList.Count;
            }

            if (current != index && wndCount > 0) {
                String list = "";
                foreach (int wnd in wf.wndList) {
                    if (list == "") list = wnd.ToString();
                    else list = list + "," + wnd.ToString();
                }
                setWindowToGroup(-1, index, list, move);
            }

            return wndCount;
        }