Пример #1
0
        public static void MinimizeWindow(string wndName)
        {
            var curhWnd = ExternalDefs.GetForegroundWindow();  // Get the handle for the current foreground window

            var hWnd = FindWindow(wndName);

            ExternalDefs.ShowWindow(hWnd, ShowWindowCommands.ForceMinimize);

            ExternalDefs.SetForegroundWindow(curhWnd);  // Set the foreground window back
        }
Пример #2
0
        public static void ClickInWindow(string wndName, int x, int y)
        {
            var curhWnd = ExternalDefs.GetForegroundWindow();                         // Get the handle for the current foreground window

            var hWnd   = FindWindow(wndName);                                         // Get the handle for the game
            int LParam = MakeLParam(x, y);                                            // create the parameter for

            ExternalDefs.SendMessage(hWnd, (int)WMessages.WM_LBUTTONDOWN, 0, LParam); // Click
            ExternalDefs.SendMessage(hWnd, (int)WMessages.WM_LBUTTONUP, 0, LParam);

            ExternalDefs.SetForegroundWindow(curhWnd);  // Set the foreground window back
        }
Пример #3
0
        public static void SendEnterPress(string wndName)
        {
            var curhWnd = ExternalDefs.GetForegroundWindow();
            var hWnd    = FindWindow(wndName);

            ExternalDefs.SetForegroundWindow(hWnd);

            var enterPress = GetEnterInput();

            ExternalDefs.SendInput(1, enterPress, Marshal.SizeOf(typeof(INPUT)));

            ExternalDefs.SetForegroundWindow(curhWnd);
        }