ShellExecuteEx返回代码 [英] ShellExecuteEx return code

查看:162
本文介绍了ShellExecuteEx返回代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何从使用shellExecuteEx()调用的批处理文件中获取返回代码。



Can someone tell me how to get the return code from a batch file that is called using shellExecuteEx().

SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = pathName;
ShExecInfo.lpParameters = "";
ShExecInfo.lpDirectory = newString;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);





谢谢,



Randy



Thanks,

Randy

推荐答案

Windows提供 GetExitCodeProcess [ ^ ]。如果 ShExecInfo.hInstance ShellExecuteEx 正确分配,您可以调用它。如果您需要更多控制权,那么您必须使用 CreateProcess [ ^ ]功能。
Windows provide the GetExitCodeProcess[^]. You may call it provided ShExecInfo.hInstance is properly assigned by ShellExecuteEx. If you need more control then you have to use the CreateProcess[^] function.


这篇关于ShellExecuteEx返回代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆