评论

收藏

[C++] 创建虚拟桌面的代码(重启桌面进程)

编程语言 编程语言 发布于:2021-08-03 14:23 | 阅读数:193 | 评论:0

在upk 里挖坟得来,有兴趣查查这几个函数...
#include "windows.h"#pragma comment(lib,"user32.lib")int 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( π, sizeof(pi) );      CreateProcess( NULL, "explorer", NULL, NULL, FALSE, 0, NULL, NULL, &si, π);    Sleep(60000);    SwitchDesktop( hold);    CloseDesktop( hhdesk);}


关注下面的标签,发现更多相似文章