您好,登錄后才能下訂單哦!
在控制臺程序的函數中使用ExitProcess函數,退出函數,調用者接收返回值:
DWORD nResult; SHELLEXECUTEINFO ShExeInfo = { 0 }; ShExeInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExeInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExeInfo.hwnd = NULL; ShExeInfo.lpVerb = NULL; ShExeInfo.lpFile = _T("a.exe"); ShExeInfo.lpParameters = _T(" 1"); ShExeInfo.lpDirectory = NULL; ShExeInfo.nShow = SW_HIDE; ShExeInfo.hInstApp = NULL; ShellExecuteEx(&ShExeInfo); WaitForSingleObject(ShExeInfo.hProcess, 1000 * 120); GetExitCodeProcess(ShExeInfo.hProcess, &nResult); //被調用進程用ExitProcess(0)返回指定的值
調用控制臺注冊組件
VOID RegisterReportCom() { SHELLEXECUTEINFO ShExecInfo = { 0 }; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExecInfo.hwnd = NULL; ShExecInfo.lpVerb = _T("runas"); ShExecInfo.lpFile = _T("C:/Windows/SysWOW64/regsvr32.exe"); CString strPath = GetApplicationPath()+ _T("gregn6.dll /s"); ShExecInfo.lpParameters = strPath ; ShExecInfo.lpDirectory = NULL; ShExecInfo.nShow = SW_HIDE; ShExecInfo.hInstApp = NULL; ShellExecuteEx(&ShExecInfo); strPath = GetApplicationPath() + _T("grdes6.dll /s"); ShExecInfo.lpParameters = strPath ; ShellExecuteEx(&ShExecInfo); }
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。