创建虚拟桌面
代码来源: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')
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)
DllCall('user32.dll', 'int', 'SetThreadDesktop', 'hwnd', $NewDesktop)
DLLCall("user32.dll","int","SwitchDesktop","int",$NewDesktop)
$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)
DllCall('user32.dll', 'int', 'SetThreadDesktop', 'hwnd', $OriginalThread)
DLLCall("user32.dll","int","CloseDesktop","int",$NewDesktop)
杀帅哥个发 本帖最后由 afan 于 2010-9-4 19:58 编辑
第一次 explorer.exe 报两次错… 之后没报错, 可能和我自己的 explorer.exe 进程有关~ --- Xpsp3
这还真是个好东西~ 学习了, 一直没搞定这个问题。 看看 ok 还没想到用这个干嘛 做个记号先 0.0 感谢大大的分享唷........ 学习了, 一直没搞定这个问题。 学习了,留名备查 好东西~~copy了 好啊。好啊。好啊。好啊。好啊。好啊。好啊。好啊。好啊。 看看,支持一下 回复 1# thesnow
请问大大,创建了虚拟桌面以后,如何切换回真实的桌面呢?如果可以切换回真实的桌面,是不是可以把一些无法后台操作的程序放在虚拟桌面里面运行,而不影响当前的操作? 测试了一下 存贮空间不足,无法处理此命令。 小手一抖,金币带走