Exemple #1
0
        public List <string> ToString(params ProcessInfo[] fields)
        {
            List <string> window = new List <string>();

            foreach (ProcessInfo field in fields)
            {
                switch (field)
                {
                case ProcessInfo.isActive:
                    window.Add(this.isAlive().ToString());
                    break;

                case ProcessInfo.pid:
                    window.Add(this.hWnd.ToString());
                    break;

                case ProcessInfo.fileName:
                    window.Add(this.imageFileName);
                    break;

                case ProcessInfo.title:
                    window.Add(WindowProcessor.GetWindowText(this.hWnd));
                    break;

                case ProcessInfo.timeRegistered:
                    window.Add(this.timeRegistered.ToString());
                    break;

                default:
                    break;
                }
            }
            return(window);
        }
Exemple #2
0
 public WindowProcess(IntPtr hWnd)
 {
     this.hWnd = hWnd;
     try
     {
         this.pid           = WindowProcessor.GetProcessId(hWnd);
         this.imageFullPath = WindowProcessor.GetProcessFilePath(this.pid);
         // imageFolderName = Path.GetDirectoryName(imageFullPath);
         this.imageFileName = Path.GetFileName(imageFullPath);
         this.windowText    = WindowProcessor.GetWindowText(hWnd);
     }
     catch (Exception ex)
     {
         Console.Out.WriteLine(ex.Message);
     }
     finally
     {
         this.timeRegistered = DateTime.Now;
     }
 }
Exemple #3
0
 public string GetWindowText()
 {
     return(WindowProcessor.GetWindowText(this.hWnd));
 }