/// <summary> /// Return the size of the window /// </summary> /// <param name="process"></param> /// <returns></returns> public static LgRectangle GetWindowRectange(LgProcess process) { RECT lpRect = default(RECT); GetWindowRect(new HandleRef(process, process.WinProcess.MainWindowHandle), out lpRect); return(new LgRectangle(lpRect.Left, lpRect.Top, lpRect.Right, lpRect.Bottom)); }
/// <summary> /// Starts process and sets the handler to the object /// </summary> /// <param name="process"></param> /// <returns></returns> public static Boolean Start(LgProcess process) { try { Process p = Process.Start(process.FullPath, process.Arguments); // wait a little in order for the handler to be assigned p.WaitForInputIdle(); process.WinProcess = p; } catch (Exception e) { MessageBox.Show(e.Message); } return(process.WinProcess != null && process.WinProcess.Responding); }
public static Boolean Stop(LgProcess process) { Process p = process.WinProcess; p.Refresh(); try { if (!p.HasExited) { p.Kill(); } } catch (Exception e) { MessageBox.Show(e.Message); } return(p.HasExited); }
/// <summary> /// Checks if the process name matches any running processes /// </summary> /// <param name="process"></param> /// <returns></returns> public static Boolean isRunning(LgProcess process) { return(Process.GetProcessesByName(process.Name).Length > 0); }
/// <summary> /// Minimize window /// </summary> /// <param name="process"></param> public static void MinimizeWindow(LgProcess process) { ShowWindowAsync(process.WinProcess.MainWindowHandle, 6); }
/// <summary> /// Show window /// </summary> /// <param name="process"></param> public static void ShowWindow(LgProcess process) { ShowWindowAsync(process.WinProcess.MainWindowHandle, 1); }
public DefaultProcess(LgProcess process) { Info = new ProcessStartInfo(process.FullPath); }
public DefaultProcess(LgProcess process) { Info = new ProcessStartInfo(process.FullPath); }