本文介绍了使用C ++代码中的Windows本地程序打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的C + +程序创建.png文件,我需要打开(查看)此文件在创建后 - 是有一种方法打开它,因为它是在 Windows资源管理器 - 所以文件wiil用户首选程序打开,如果没有与文件格式相关联的程序 - Windows将显示对话窗口,用户将能够选择任何程序打开该文件。
感谢。
解决方案
在Windows上,您可以使用。
My C++ program creates .png file and I need to open (view) this file right after creation - is there a way to open it as so it was opened within Windows explorer - so file wiil be opened with user's preferred program and if there are no associated programs with file's format - Windows will show dialog window in which user will be able to select any program to open that file.
Crossplatform (+Linux, +MacOS, +BSD) solution will be perfect.
Thanks.
解决方案
On Windows, you can use the ShellExecute
function.
这篇关于使用C ++代码中的Windows本地程序打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!