Reputation: 1432
In my program I have a CImage that gets saved to a .bmp file on the hard drive. How can I have my program automatically open that picture in Windows Photo Viewer?
Upvotes: 0
Views: 2630
Reputation: 4395
This question is old but I was also looking for the same and got the answer.
Hope it will be helpful for others also.
::ShellExecute(NULL,L"open",_T("rundll32.exe"),_T("shimgvw.dll,ImageView_Fullscreen picture.bmp"),NULL,SW_SHOWNORMAL);
This will open the picture in Windows Default Photo Viewer.
at the place of picture.bmp
you need to pass full path of the picture/image like D:\\picture.bmp
.
Upvotes: 0
Reputation: 5138
If you want the default program for that file type/extension to open the file, then you will have to open a shell and tell it to open the program for that file type.
See: How can you open a file with the program associated with its file extension? for more details.
Upvotes: 1
Reputation: 3020
You should just run the program, and probably give path to the file you want to open through command line parameters. It really depnds on the program you want to run.
On Linux, to start a program, you should use fork
/ exec
pair. On Windows, you use CreateProcess
Upvotes: 0