繁体   English   中英

C++ - 使用带有 ShellExecute 的 Windows 照片查看器打开图像

[英]C++ - Opening an image with Windows Photo Viewer with ShellExecute

我想在我的 C++ 程序中使用 ShellExecute 来强制在 W7 和 W10 上使用 Windows 照片查看器打开 tiff 图像。 默认情况下,tiff 图像是用我机器上的另一个查看器打开的。 目标是拥有一个灵活的解决方案,无论用于打开 tiff 图像的默认程序是什么,它都可以工作。

在 cmd.exe 中运行它可以满足我的需求:

rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen C:\Temp\myimage.tif

现在,这将如何在我的 ShellExecute 参数中转换? 我尝试了以下方法,但不起作用。 不确定它是语法还是我没有向函数发送正确的参数。

ShellExecute(NULL, _T("open"), _T("rundll32 \"%ProgramFiles%\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen C:\\Temp\\myimage.tif"), NULL, NULL , SW_HIDE);

谢谢!

这在 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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM