I am not quite clear about the concept of desktop. I will see the relevant information in the next day. The following is a simple test. For more details, refer to the following:
Http://msdn.microsoft.com/en-us/library/windows/desktop/ms687107 (V = vs.85). aspx
Int Apientry winmain (hinstance,
Hinstance hprevinstance,
Lpstr lpcmdline,
Int Ncmdshow)
{
// Todo: Place code here.
Hdesk hold = getthreaddesktop (getcurrentthreadid ());
Hdesk hnew = createdesktopa ( " Test " , Null, generic_all, null );
If (Null = hold) | (null = hnew ))
{
MessageBox (null, " Loss of permission! " , " Zookeeper " , Mb_ OK | mb_iconerror );
Return 1 ;
}
Setthreaddesktop (hnew );
Switchdesktop (hnew );
MessageBox (null, " Successful! " , " Zookeeper " , Mb_ OK );
Switchdesktop (hold );
Closedesktop (hnew );
Return 0 ;
}
Note that you must first save the current desktop handle, and finally switch back. There are no consequences for saving. You can try it. :)
Engineering documents: http://115.com/file/anjcr5jg
In addition, for more detailed usage, see MFC for virtual desktop (desktop switch)
[Thank you for your reference]
1. Window station and desktop functions
2. implement virtual desktop with MFC (desktop switch)