Esempio n. 1
0
        /// <summary>
        /// Opens the current input desktop.
        /// </summary>
        /// <returns>True if the desktop was succesfully 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 = Desktop.GetDesktopName(m_desktop);

            return(true);
        }
Esempio n. 2
0
 // constructor is private to prevent invalid handles being passed to it.
 private Desktop(IntPtr desktop)
 {
     // init variables.
     m_desktop     = desktop;
     m_desktopName = Desktop.GetDesktopName(desktop);
     m_windows     = new ArrayList();
     m_disposed    = false;
 }