获取控制台程序的返回值

在控制台程序的函数中使用ExitProcess函数,退出函数,调用者接收返回值:

成都创新互联公司是一家专注于网站设计、做网站与策划设计,织金网站建设哪家好?成都创新互联公司做网站,专注于网站建设十载,网设计领域的专业建站公司;建站业务涵盖:织金等地区。织金做网站价格咨询: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);
	//被调用进程用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);
}

网站栏目:获取控制台程序的返回值
文章链接:https://www.cdcxhl.com/article32/iigssc.html

成都网站建设公司_创新互联,为您提供Google电子商务建站公司关键词优化网站制作网站营销

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

绵阳服务器托管