1. 程式人生 > >獲取控件臺程序的返回值

獲取控件臺程序的返回值

控制臺返回值

在控制臺程序的函數中使用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);


獲取控件臺程序的返回值