Reputation: 332
I would like to use ShellExecute in my C++ program to force the opening of a tiff image with Windows Photo Viewer on W7 and W10. By default, tiff images are opened with another viewer on my machine. The goal is to have a flexible solution that will work no matter what is the default program used to open tiff images.
Running this in cmd.exe does what I need:
rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen C:\Temp\myimage.tif
Now, how would that translate in my ShellExecute parameters? I tried the following, but it does not work. Not sure if it's syntax or I am not sending the right parameters to the function.
ShellExecute(NULL, _T("open"), _T("rundll32 \"%ProgramFiles%\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen C:\\Temp\\myimage.tif"), NULL, NULL , SW_HIDE);
Thanks!
Upvotes: 0
Views: 2183
Reputation: 161
This works for me on Win 10
ShellExecute(
NULL, //-- hwnd
"open", //-- lpOperation
"rundll32.exe", //-- lpFile
//-- lpParameters
"\"C:\\Program Files\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen C:\\temp\\P1000325.jpg",
NULL, //-- lpDirectory
SW_HIDE); //-- nShowCmd
Upvotes: 0