/// <summary> /// Gets the name of a given desktop. /// </summary> /// <param name="desktop">Desktop object whose name is to be found.</param> /// <returns>If successful, the desktop name, otherwise, null.</returns> public static string GetDesktopName([NotNull] Desktop desktop) { return(desktop.IsOpen ? null : GetDesktopName(desktop.DesktopHandle)); }
/// <summary> /// Sets the desktop of the calling thread. /// NOTE: Function will fail if thread has hooks or windows in the current desktop. /// </summary> /// <param name="desktop">Desktop to put the thread in.</param> /// <returns>True if the threads desktop was successfully changed.</returns> public static bool SetCurrent([NotNull] Desktop desktop) { return(desktop.IsOpen && Win32.SetThreadDesktop(desktop.DesktopHandle)); }