在控制臺(tái)程序的函數(shù)中使用ExitProcess函數(shù),退出函數(shù),調(diào)用者接收返回值:
成都創(chuàng)新互聯(lián)公司是一家專注于網(wǎng)站設(shè)計(jì)、做網(wǎng)站與策劃設(shè)計(jì),織金網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)公司做網(wǎng)站,專注于網(wǎng)站建設(shè)十載,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:織金等地區(qū)。織金做網(wǎng)站價(jià)格咨詢:18982081108
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); //被調(diào)用進(jìn)程用ExitProcess(0)返回指定的值
調(diào)用控制臺(tái)注冊(cè)組件
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); }