Desktops

A desktop is a secure object contained within a window station. A desktop has a logical display surface and contains windows, menus, and hooks. A window station can have multiple desktops. Only the desktops of the interactive window station can be visible and receive user input. On the interactive window station, only one desktop at a time is active. This active desktop, also known as the input desktop, is the one that is currently visible to the user and that receives user input. Applications can use the OpenInputDesktop function to get a handle of the input desktop. Applications that have the necessary access can use the SwitchDesktop function to specify a different input desktop.

Invisible, noninteractive window stations enable Win32 services that do not have access to the interactive window station to start GUI applications. Applications running in a noninteractive window station cannot receive input or be visible. For example, the schedule service could use this support to start a GUI backup application on a remote computer on which the interactive window station was not accessible. For more information, see Interactive Services.

Applications can use the following functions for manipulating desktop objects:

Function Description
CloseDesktop Closes a specified desktop.
CreateDesktop Creates a new desktop on a specified window station.
EnumDesktops Enumerates the desktops on a specified window station by repeatedly calling an application-defined EnumDesktopProc callback function.
EnumDesktopWindows Enumerates the windows on a specified desktop by repeatedly calling an application-defined EnumWindowsProc callback function.
GetThreadDesktop Returns a handle of the desktop assigned to the calling thread.
GetUserObjectInformation Gets information about a window station or desktop object.
GetUserObjectSecurity Gets security information for a window station or desktop object.
OpenDesktop Opens a handle of an existing desktop.
SetThreadDesktop Assigns a specified desktop to the calling thread.
SetUserObjectInformation Sets information about a window station or desktop object.
SetUserObjectSecurity Sets security information for a window station or desktop object.