donneyming

 明白了虚拟桌面的原理后发现就使用了3个函数就可以实现,

源码如下:

 /Files/donneyming/vdesktop.rar

首先创建一个新的桌面,然后调用创建进程函数创建explorer进程,切换桌面 ~

3个主要函数原型如下:

 

HDESK CreateDesktop(

LPCTSTR
lpszDesktop, // name of new desktop

LPCTSTR lpszDevice, // reserved; must be NULL

LPDEVMODE pDevmode, // reserved; must be NULL

DWORD dwFlags, // desktop interaction

ACCESS_MASK dwDesiredAccess, // access of returned handle

LPSECURITY_ATTRIBUTES lpsa // security attributes

);

 

BOOL CreateProcess(

LPCTSTR
lpApplicationName, // name of executable module

LPTSTR lpCommandLine, // command line string

LPSECURITY_ATTRIBUTES lpProcessAttributes, // SD

LPSECURITY_ATTRIBUTES lpThreadAttributes, // SD

BOOL bInheritHandles, // handle inheritance option

DWORD dwCreationFlags, // creation flags

LPVOID lpEnvironment, // new environment block

LPCTSTR lpCurrentDirectory, // current directory name

LPSTARTUPINFO lpStartupInfo, // startup information

LPPROCESS_INFORMATION lpProcessInformation // process information

);

 

BOOL SwitchDesktop(

HDESK
hDesktop // handle to desktop to activate

);
不过程序还有点小问题~在修改中~

分类:

技术点:

相关文章: