public static int GetWindowState(IntPtr hWnd) { WINDOWPLACEMENT placement = new WINDOWPLACEMENT(); placement.Length = Marshal.SizeOf(placement); ExternalDefs.GetWindowPlacement(hWnd, ref placement); return((int)placement.ShowCmd); }
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 }
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 }
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); }
public static IntPtr FindWindow(string wndName) { return(ExternalDefs.FindWindow(null, wndName)); }
public static IntPtr GetActiveWindow() { return(ExternalDefs.GetActiveWindow()); }