Group: Window Station and Desktop - Library: user32
Assigns the specified desktop to the calling thread. All subsequent operations on the desktop use the access rights granted to hDesktop.
How to prevent users from accessing the Windows Desktop and from switching to other applications
BOOL SetThreadDesktop(
HDESK hDesktop
);
DECLARE INTEGER SetThreadDesktop IN user32;
INTEGER hDesktop
hDesktop [in] Handle to the desktop to be assigned to the calling thread. This handle is returned by the CreateDesktop, GetThreadDesktop, OpenDesktop, or OpenInputDesktop function.
If the function succeeds, the return value is nonzero.
See also: CreateDesktop, GetThreadDesktop, OpenDesktop, SetProcessWindowStation.