c – 如何获取ShellExecute调用的exe的返回值

c – 如何获取ShellExecute调用的exe的返回值,第1张

概述如何获取由 shellexecute函数调用的exe的返回值. ShellExecute(NULL, NULL, TEXT ( ".\\dpinstx86.exe" ), NULL, NULL, SW_SHOWNORMAL); 在上面的例子中,我想要“dpinstx86.exe”的返回值. 使用 ShellExecuteEx取代过程句柄,并使用 GetExitCodeProcess获取退出代码. 如何获取由 shellexecute函数调用的exe的返回值.
ShellExecute(NulL,NulL,TEXT ( ".\dpinstx86.exe" ),SW_SHOWnorMAL);

在上面的例子中,我想要“dpinstx86.exe”的返回值.

@H_403_7@解决方法 使用 ShellExecuteEx取代过程句柄,并使用 GetExitCodeProcess获取退出代码.
SHELLEXECUTEINFO ShExecInfo = {0};ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;ShExecInfo.hwnd = NulL;ShExecInfo.lpVerb = NulL;ShExecInfo.lpfile = "c:\MyProgram.exe";        ShExecInfo.lpParameters = "";   ShExecInfo.lpDirectory = NulL;ShExecInfo.nShow = SW_SHOW;ShExecInfo.hInstApp = NulL; ShellExecuteEx(&ShExecInfo);WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
总结

以上是内存溢出为你收集整理的c – 如何获取ShellExecute调用的exe的返回值全部内容,希望文章能够帮你解决c – 如何获取ShellExecute调用的exe的返回值所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1252908.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-07
下一篇 2022-06-07

发表评论

登录后才能评论

评论列表(0条)

保存