0

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?

tshepang
  • 12,111
  • 21
  • 91
  • 136
xcdemon05
  • 1,372
  • 5
  • 25
  • 49

3 Answers3

1

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.

Community
  • 1
  • 1
Thomas
  • 4,980
  • 2
  • 15
  • 30
0

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

Hayri Uğur Koltuk
  • 2,970
  • 4
  • 31
  • 60
0

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.

Himanshu
  • 4,327
  • 16
  • 31
  • 39