码迷,mamicode.com
首页 > 其他好文 > 详细

服务端启动EXE

时间:2017-07-07 10:18:35      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:服务端 exe


HDESK hdeskCurrent;
HDESK hdesk;
HWINSTA hwinstaCurrent;
HWINSTA hwinsta;
hwinstaCurrent = GetProcessWindowStation();
hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
//打开用户的winsta0
hwinsta = OpenWindowStation("winsta0", FALSE,
WINSTA_ACCESSCLIPBOARD |
WINSTA_ACCESSGLOBALATOMS |
WINSTA_CREATEDESKTOP |
WINSTA_ENUMDESKTOPS |
WINSTA_ENUMERATE |
WINSTA_EXITWINDOWS |
WINSTA_READATTRIBUTES |
WINSTA_READSCREEN |
WINSTA_WRITEATTRIBUTES);
//打开desktop
hdesk = OpenDesktop("default", 0, FALSE,
DESKTOP_CREATEMENU |
DESKTOP_CREATEWINDOW |
DESKTOP_ENUMERATE |
DESKTOP_HOOKCONTROL |
DESKTOP_JOURNALPLAYBACK |
DESKTOP_JOURNALRECORD |
DESKTOP_READOBJECTS |
DESKTOP_SWITCHDESKTOP |
DESKTOP_WRITEOBJECTS);
SetThreadDesktop(hdesk);
ShellExecute(0,NULL,"D://test.exe",NULL,NULL,SW_HIDE);
SetProcessWindowStation(hwinstaCurrent);
SetThreadDesktop(hdeskCurrent);
CloseWindowStation(hwinsta);
CloseDesktop(hdesk);

本文出自 “xueyise” 博客,请务必保留此出处http://1483803.blog.51cto.com/1473803/1945130

服务端启动EXE

标签:服务端 exe

原文地址:http://1483803.blog.51cto.com/1473803/1945130

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!