Example #1
0
        /// <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));
        }
Example #2
0
        /// <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);
        }
Example #3
0
        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);
        }
Example #4
0
 /// <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);
 }
Example #5
0
 /// <summary>
 /// Minimize window
 /// </summary>
 /// <param name="process"></param>
 public static void MinimizeWindow(LgProcess process)
 {
     ShowWindowAsync(process.WinProcess.MainWindowHandle, 6);
 }
Example #6
0
 /// <summary>
 /// Show window
 /// </summary>
 /// <param name="process"></param>
 public static void ShowWindow(LgProcess process)
 {
     ShowWindowAsync(process.WinProcess.MainWindowHandle, 1);
 }
Example #7
0
 public DefaultProcess(LgProcess process)
 {
     Info = new ProcessStartInfo(process.FullPath);
 }
Example #8
0
 public DefaultProcess(LgProcess process)
 {
     Info = new ProcessStartInfo(process.FullPath);
 }