Hi,
if i kill the desktop's default shell ("prog manager", explorer.exe)
then the desktop was destroyed.
here is an example, you show a msgbox end then the main process exit end the
desktop will close.
HDESK hdeskOriginalThread = GetThreadDesktop(GetCurrentThreadId());
HDESK hdeskOriginalInput =
OpenInputDesktop(0,FALSE,DESKTOP_SWITCHDESKTOP);
HDESK hdeskNewDesktop = CreateDesktop(TEXT("MyDesktop"), NULL, NULL, 0,
GENERIC_ALL, NULL);
SetThreadDesktop(hdeskNewDesktop);
SwitchDesktop(hdeskNewDesktop);
MessageBox(NULL, TEXT("This message is appearing on a new desktop!"),
TEXT("Desktop Demo"),MB_OK);
SwitchDesktop(hdeskOriginalInput);
SetThreadDesktop(hdeskOriginalThread);
CloseDesktop(hdeskNewDesktop);
if you try this the desktop don't close because explorer.exe, the main
window shell, still running
HDESK hdeskNewDesktop = CreateDesktop(TEXT("MyDesktop"), NULL, NULL, 0,
GENERIC_ALL, NULL);
PROCESS_INFORMATION pi = {0};
STARTUPINFO si = {0};
si.cb = sizeof(si);
si.lpTitle = TEXT("title");
si.lpDesktop = TEXT("MyDesktop"); // here's the important line!
CreateProcess(NULL, TEXT("explorer.exe"), NULL, NULL, TRUE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &si,&pi)
SwitchDesktop(hdeskNewDesktop);
thanks
Alberto
ps. sorry for my english