procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;
procedure SwitchToDesktop(number: integer);
var name: string;
DsktpHandle: HDESK;
SysPath: array[1..MAX_PATH] of char;
PPath: PChar;
StrPath: string;
len: integer;
si: STARTUPINFO;
pi: PROCESS_INFORMATION;
begin
if number = 1 then
name := 'Default'
else
name := 'NewDesktop' + inttostr(number);
ZeroMemory(@si, sizeof(STARTUPINFO));
si.cb := sizeof(STARTUPINFO);
si.dwFlags := STARTF_USESHOWWINDOW or STARTF_USESTDHANDLES;
si.wShowWindow := SW_SHOW;
si.lpDesktop := PChar(Name);
DsktpHandle := OpenDesktop(pchar(Name),
DF_ALLOWOTHERACCOUNTHOOK, true,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS);
if DsktpHandle = 0 then
begin
// 桌面不存在,创建桌面
DsktpHandle := CreateDesktop(PChar(Name), nil, nil,
DF_ALLOWOTHERACCOUNTHOOK,
DESKTOP_CREATEMENU or DESKTOP_CREATEWINDOW or
DESKTOP_ENUMERATE or DESKTOP_HOOKCONTROL or
DESKTOP_JOURNALPLAYBACK or
DESKTOP_JOURNALRECORD or DESKTOP_READOBJECTS or
DESKTOP_SWITCHDESKTOP or DESKTOP_WRITEOBJECTS,
nil);
if DsktpHandle = 0 then
begin
ShowMessage('打开桌面失败! ' + SysErrorMessage(GetLastError));
exit;
end;
PPath := @SysPath;
len := GetWindowsDirectory(@SysPath, MAX_PATH);
SetString(StrPath, PPath, len);
if (not CreateProcess(PChar(StrPath + '/explorer.exe'), nil, nil, nil, True, 0, nil, nil, si, pi)) then
begin
ShowMessage('进程创建失败! ' + SysErrorMessage(GetLastError));
CloseDeskTop(DsktpHandle);
exit;
end;
end;
SwitchDesktop(DsktpHandle);
end;