private SEBDesktopController(IntPtr desktop)
 {
     this.m_desktop     = desktop;
     this.m_desktopName = SEBDesktopController.GetDesktopName(desktop);
     this.m_windows     = new ArrayList();
     this.m_disposed    = false;
 }
Пример #2
0
        /// <summary>
        /// Opens the current input desktop.
        /// </summary>
        /// <returns>True if the desktop was successfully opened.</returns>
        public bool OpenInput()
        {
            // make sure object isnt disposed.
            CheckDisposed();

            // close the open desktop.
            if (m_desktop != IntPtr.Zero)
            {
                // attempt to close the desktop.
                if (!Close())
                {
                    return(false);
                }
            }

            // open the desktop.
            m_desktop = OpenInputDesktop(0, true, AccessRights);

            // something went wrong.
            if (m_desktop == IntPtr.Zero)
            {
                return(false);
            }

            // get the desktop name.
            m_desktopName = SEBDesktopController.GetDesktopName(m_desktop);

            return(true);
        }
Пример #3
0
 // constructor is private to prevent invalid handles being passed to it.
 private SEBDesktopController(IntPtr desktop)
 {
     // init variables.
     m_desktop     = desktop;
     m_desktopName = SEBDesktopController.GetDesktopName(desktop);
     m_windows     = new ArrayList();
     m_disposed    = false;
 }
 public static string GetDesktopName(SEBDesktopController desktop)
 {
     if (desktop.IsOpen)
     {
         return((string)null);
     }
     return(SEBDesktopController.GetDesktopName(desktop.DesktopHandle));
 }
 public bool OpenInput()
 {
     this.CheckDisposed();
     if (this.m_desktop != IntPtr.Zero && !this.Close())
     {
         return(false);
     }
     this.m_desktop = SEBDesktopController.OpenInputDesktop(0U, true, 511U);
     if (this.m_desktop == IntPtr.Zero)
     {
         return(false);
     }
     this.m_desktopName = SEBDesktopController.GetDesktopName(this.m_desktop);
     return(true);
 }
        public static Process[] GetInputProcessesWithGI()
        {
            Process[] processes = Process.GetProcesses();
            ArrayList arrayList = new ArrayList();

            SEBDesktopController.GetDesktopName(SEBDesktopController.Input.DesktopHandle);
            foreach (Process process in processes)
            {
                if (process.MainWindowTitle.Length > 0)
                {
                    arrayList.Add((object)process);
                }
            }
            Process[] processArray = new Process[arrayList.Count];
            for (int index = 0; index < processArray.Length; ++index)
            {
                processArray[index] = (Process)arrayList[index];
            }
            return(processArray);
        }
        public static Process[] GetInputProcesses()
        {
            Process[] processes   = Process.GetProcesses();
            ArrayList arrayList   = new ArrayList();
            string    desktopName = SEBDesktopController.GetDesktopName(SEBDesktopController.Input.DesktopHandle);

            foreach (Process process in processes)
            {
                foreach (ProcessThread thread in (ReadOnlyCollectionBase)process.Threads)
                {
                    if (SEBDesktopController.GetDesktopName(SEBDesktopController.GetThreadDesktop(thread.Id)) == desktopName)
                    {
                        arrayList.Add((object)process);
                        break;
                    }
                }
            }
            Process[] processArray = new Process[arrayList.Count];
            for (int index = 0; index < processArray.Length; ++index)
            {
                processArray[index] = (Process)arrayList[index];
            }
            return(processArray);
        }