一段创建虚拟桌面的代码
就那么几个API,不过蛮好玩的#include "windows.h"
void main()
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
char DeskName[]="pp";
HDESK hold = GetThreadDesktop(GetCurrentThreadId());
HDESK hhdesk = CreateDesktop( DeskName, NULL, NULL, DF_ALLOWOTHERACCOUNTHOOK, GENERIC_ALL, NULL);
SwitchDesktop( hhdesk);
SetThreadDesktop( hhdesk);
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.lpDesktop = DeskName;
ZeroMemory( &pi, sizeof(pi) );
CreateProcess( NULL, "explorer", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
Sleep(60000);
SwitchDesktop( hold);
CloseDesktop( hhdesk);
}
页:
[1]