Search code examples
c++windowsexplorergraphvizwindows-explorer

Open file with Windows' native program within C++ code


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.


Solution

  • On Windows, you can use the ShellExecute function.