The SwitchDesktop function makes a desktop visible and activates it. This enables the desktop to receive input from the user. The calling process must have DESKTOP_SWITCHDESKTOP access to the desktop for the SwitchDesktop function to succeed.
BOOL SwitchDesktop(
HDESK hDesktop // handle to desktop to activate
);
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
The SwitchDesktop function will fail if the desktop belongs to an invisible window station.
Windows NT: Requires version 3.51 or later.
Windows: Unsupported.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Window Stations and Desktops Overview, Window Station and Desktop Functions, CreateDesktop, OpenDesktop