代码来源:HOOK
弱弱修改,只作参考用.
注意:貌似WIN7没有area.很不爽.
#include <WinAPI.au3>
Global Const $DESKTOP_ENUMERATE = 0x40
Global Const $SPI_GETSCREENSAVERRUNNING = 114
Global Const $DESKTOP_SWITCHDESKTOP = 0x100
$OriginalThread = DLLCall("kernel32.dll","int","GetCurrentThreadId")
$OriginalInput = DllCall('user32.dll', 'hwnd', 'OpenInputDesktop', 'int', 0, 'int', 0, 'int', 0x100)
$NewDesktopName=DllStructCreate('wchar[255]')
DllStructSetData($NewDesktopName,1,'DeskName')
$NewDesktop = DLLCall("user32.dll","hwnd","CreateDesktopW","ptr",DllStructGetPtr($NewDesktopName,1), "str",'',"ptr",0,"dword",0x1,"int",$GENERIC_ALL,"ptr",0)
MsgBox(32,'',_WinAPI_GetLastErrorMessage())
MsgBox(32,"创建的句柄",$NewDesktop[0])
DllCall('user32.dll', 'int', 'SetThreadDesktop', 'hwnd', $NewDesktop[0])
DLLCall("user32.dll","int","SwitchDesktop","int",$NewDesktop[0])
$Startup = DllStructCreate($tagSTARTUPINFO)
$Process = DllStructCreate($tagPROCESS_INFORMATION)
;~ $NewDesktopName
DllStructSetData($Startup, "Size", DllStructGetSize($Startup))
DllStructSetData($Startup, "Desktop", DllStructGetPtr($NewDesktopName,1))
_WinAPI_CreateProcess("", "C:\Windows\explorer.exe", 0, 0, False, 0, 0, "", DllStructGetPtr($Startup), DllStructGetPtr($Process))
Sleep(5000)
_WinAPI_CloseHandle(DllStructGetData($Process, "hProcess"))
_WinAPI_CloseHandle(DllStructGetData($Process, "hThread" ))
DLLCall("user32.dll","int","SwitchDesktop","int",$OriginalInput[0])
DllCall('user32.dll', 'int', 'SetThreadDesktop', 'hwnd', $OriginalThread[0])
DLLCall("user32.dll","int","CloseDesktop","int",$NewDesktop[0])
|