Example #1
0
        public static int GetWindowState(IntPtr hWnd)
        {
            WINDOWPLACEMENT placement = new WINDOWPLACEMENT();

            placement.Length = Marshal.SizeOf(placement);
            ExternalDefs.GetWindowPlacement(hWnd, ref placement);

            return((int)placement.ShowCmd);
        }
Example #2
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
        }
Example #3
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
        }
Example #4
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);
        }
Example #5
0
 public static IntPtr FindWindow(string wndName)
 {
     return(ExternalDefs.FindWindow(null, wndName));
 }
Example #6
0
 public static IntPtr GetActiveWindow()
 {
     return(ExternalDefs.GetActiveWindow());
 }