封装成一个小的函数,来代替system函数 void xsystem(const TCHAR* cmd, const TCHAR* par, int nShow) { SHELLEXECUTEINFO ShExecInfo = {0}; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExecInfo.hwnd = NULL; ShExecInfo.lpVerb = NULL; ShExecInfo.lpFile = cmd; ShExecInfo.lpParameters = par; ShExecInfo.lpDirectory = NULL; ShExecInfo.nShow = nShow; ShExecInfo.hInstApp = NULL; ShellExecuteEx(&ShExecInfo); WaitForSingleObject(ShExecInfo.hProcess,INFINITE); } 如关闭桌面程序 xsystem(_T("taskkill.exe"), _T("/f /im explorer.exe"), SW_HIDE); |
|