/// <summary> /// Add new Window to the config from a coordinate in the screen. Usually from a mouse click. /// </summary> /// <param name="point">point in screen</param> /// <returns></returns> internal Boolean AddWindow(LgPoint point) { Boolean result = true; Process p = LgProcessManager.GetProcessAtCoordiante(point); // before adding check if it is current process if (!LgProcessManager.IsCurrentProcess(p)) { LgProcess process = LgProcess.FromProcess(p); LgRectangle rec = LgProcessManager.GetWindowRectange(process); LgWindow window = new LgWindow(rec.GetTopLeft(), rec.GetSize(), process); // add to list Windows.Add(window); Console.WriteLine(window); } else { result = false; } return(result); }
/// <summary> /// Add new Window to the config from a coordinate in the screen. Usually from a mouse click. /// </summary> /// <param name="point">point in screen</param> /// <returns></returns> internal Boolean AddWindow(LgPoint point) { Boolean result = true; Process p = LgProcessManager.GetProcessAtCoordiante(point); // before adding check if it is current process if (!LgProcessManager.IsCurrentProcess(p)) { LgProcess process = LgProcess.FromProcess(p); LgRectangle rec = LgProcessManager.GetWindowRectange(process); LgWindow window = new LgWindow(rec.GetTopLeft(), rec.GetSize(), process); // add to list Windows.Add(window); Console.WriteLine(window); }else { result = false; } return result; }
/// <summary> /// Move and resize the window to the current values /// </summary> /// <param name="window"></param> public static Boolean Reposition(LgWindow window) { IntPtr hande = window.Process.WinProcess.MainWindowHandle; if (hande == IntPtr.Zero) return false; return MoveWindow(hande, window.TopLeft.X, window.TopLeft.Y, window.Size.Width, window.Size.Height, true); }