Martin Fuchs wrote:
Using CreateDesktop() and SwitchDesktop() shows the following problems:
- It's not possible to share the notification area among different desktops.
- If you want to launch programs from those additional desktops, it's not
enough to create a new thread per desktop, you have to launch an explicit new explorer processes for each of the desktops.
- You can't (simply) move one application from one desktop to another.
(However it could be possible by using a thread-/DLL-injection technic, I didn't try this.)
The inability to move application windows is by design, desktops wouldn't count as a "secure object" otherwise. You can move threads across desktops, but only as long as they don't have windows and other similar things.
About sharing the tray, you could do this by creating a memory mapped file or some other kind of shared memory which holds the internal NID list. At least if you want to use separate instances of Explorer. If you just want a single instance it's easier to share data, but it's more difficult to implement the rest. =) You need to create one thread per desktop and duplicate all UI elements in all those threads. I have never tried to implement this particular scenario, but it appears to be possible. Personally I'd go the one-process-per-desktop route with shared memory.
Note that if you're just after VWM-style functionality, you don't really need to use those APIs. What Litestep does is simply moving the windows off-screen, for example 10000 pixels to the right. Except for some glitches with the recent XP Styles, this has worked fine since '97 or '98. I can point you to some GPL'ed implementations if you want; if you want to test the binaries go to www.litestep.net, register (requirement by the host, we don't complain for $0 hosting), and download the installer.