How to programmatically open Run c++?

旧时模样 提交于 2019-12-10 13:57:55

问题


the question is how to open Run programmatically from c++? I know that have some function that can replace that, like shellexec, winexec but for some task I need just Run dialog to appear.


回答1:


The Run Dialog is located in shell32.dll using the function RunFileDlg. One way show the dialog is to use rundll32.exe to invoke that function. Execute the following command using the CreateProcess Win32 API:

rundll32.exe shell32.dll,#61

(where #61 is the ordinal number of the RunFileDlg function).

Reference for shell32.dll functions: http://www.geoffchappell.com/viewer.htm?doc=studies/windows/shell/shell32/api/index.htm

Hope this helps.




回答2:


Use shellexec, winexec or any other favorite function to execute

rundll32.exe shell32.dll,#61

This will open the dialog.




回答3:


Something like:

#include <cstdlib>

system("rundll32.exe shell32.dll,#61");


来源:https://stackoverflow.com/questions/4356270/how-to-programmatically-open-run-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!