5

问题是如何从 C++ 以编程方式打开运行?我知道有一些可以替代它的功能,例如 shellexec、winexec,但对于某些任务,我只需要出现运行对话框。

4

3 回答 3

8

运行对话框使用函数位于 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

希望这可以帮助。

于 2010-12-04T23:08:00.000 回答
2

使用 shellexec、winexec 或任何其他喜欢的函数来执行

rundll32.exe shell32.dll,#61

这将打开对话框。

于 2010-12-04T23:06:20.593 回答
1

就像是:

#include <cstdlib>

system("rundll32.exe shell32.dll,#61");
于 2010-12-04T23:06:21.710 回答