SwitchDesktop

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
);
 

Parameters

hDesktop
Handle to the desktop to be made visible and active. This handle is returned by the CreateDesktop and OpenDesktop functions.

Return Values

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.

Remarks

The SwitchDesktop function will fail if the desktop belongs to an invisible window station.

QuickInfo

  Windows NT: Requires version 3.51 or later.
  Windows: Unsupported.
  Windows CE: Unsupported.
  Header: Declared in winuser.h.
  Import Library: Use user32.lib.

See Also

Window Stations and Desktops Overview, Window Station and Desktop Functions, CreateDesktop, OpenDesktop