码迷,mamicode.com
首页 > 系统相关 > 详细

ShellExecuteEx 阻塞和异步调用进程的两种方法

时间:2017-04-20 20:09:18      阅读:2339      评论:0      收藏:0      [点我收藏+]

标签:tap   管理   eof   app   str   tar   infinite   rtp   close   

阻塞:

SHELLEXECUTEINFO ShExecInfo = { 0 };
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = (LPCWSTR)newAppPath.utf16(); // _telegramPath.toLocal8Bit().constData();
ShExecInfo.lpParameters = L"";
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOWNORMAL;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess, INFINITE);

异步:

ShellExecuteA(NULL, "open", _telegramPath.toLocal8Bit().data(),telegramStartParm.c_str(), NULL, SW_SHOWNORMAL); 

 

备注:SW_SHOWNORMAL表示管理员权限调用

ShellExecuteEx 阻塞和异步调用进程的两种方法

标签:tap   管理   eof   app   str   tar   infinite   rtp   close   

原文地址:http://www.cnblogs.com/gx1069/p/6740036.html

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