【发布时间】:2010-12-04 22:52:17
【问题描述】:
问题是如何从 c++ 以编程方式打开 Run?我知道有一些功能可以替代它,比如 shellexec、winexec,但对于某些任务,我只需要出现运行对话框。
【问题讨论】:
标签: c++ shellexecute
问题是如何从 c++ 以编程方式打开 Run?我知道有一些功能可以替代它,比如 shellexec、winexec,但对于某些任务,我只需要出现运行对话框。
【问题讨论】:
标签: c++ shellexecute
运行对话框位于 shell32.dll 中,使用函数 RunFileDlg。显示对话框的一种方法是使用 rundll32.exe 调用该函数。使用CreateProcess Win32 API 执行以下命令:
rundll32.exe shell32.dll,#61
(其中#61 是RunFileDlg 函数的序号)。
shell32.dll 函数参考:http://www.geoffchappell.com/viewer.htm?doc=studies/windows/shell/shell32/api/index.htm
希望这会有所帮助。
【讨论】:
使用 shellexec、winexec 或任何其他喜欢的函数来执行
rundll32.exe shell32.dll,#61
这将打开对话框。
【讨论】:
类似:
#include <cstdlib>
system("rundll32.exe shell32.dll,#61");
【讨论】: