c++ - 使用 "Photos metro application"显示图像

标签 c++ visual-c++ windows-store-apps microsoft-metro windows-mobile

我正在尝试使用“Photos metro 应用程序”(C++) 显示图像。 下面是我可以用来显示图像的代码片段。 但我只想使用“照片”metro 应用程序来显示我的图像。 如果我手动右键单击每个图像并在属性菜单中将其默认应用程序更改为“照片”,那么下面的代码片段可以正常工作以使用“照片应用程序”显示图像。

但我想在 mu 代码中嵌入选择用于显示图像的应用程序的控件。 如何使用 Photos metro 应用强制我的代码显示“color.png”图像?

int DisplayImage(std::string image)
{
    printf("\nThe image is %s", image);
    std::string command = "Start " + image;
    system(command.c_str());
......
......
}

I want to run this code on a mobile phone/tablet but my code generates an EXE (not a metro Windows store app). I use TSHELL to run my EXE in mtero mobile phone/tablet enviroment.

最佳答案

您打算如何处理用户未安装照片应用的情况?

您可以在默认处理程序中启动照片(正如您正在做的那样),如果用户选择了它,它将显示在照片应用程序中。这通常是正确的做法,并且对用户友好。这是在 Windows 应用商店应用程序中以编程方式启动照片或照片应用程序的唯一方法。

在桌面应用程序中,您可以通过调用 IActivateActivationManager 使用文件显式激活 Windows 运行时应用程序::ActivateForFile方法。这不能从 Windows 运行时应用程序调用。与您现有的代码一样,它不会在生产手机上运行。

要编写 Windows 运行时应用(Windows 应用商店或 Windows Phone 应用商店),您需要从 Visual Studio 中的 Windows 应用商店模板之一开始。您不能将控制台应用编写为 Windows 运行时应用。参见 Get startedWindows Developer Center在 MSDN 上获取有关如何编写 Windows 运行时应用程序的概述。

关于c++ - 使用 "Photos metro application"显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28831134/

相关文章:

c++ - 如何在 C++ 中获取指向 main() 方法的函数指针?

c++ - 为什么将 int 转换为 bool 会发出警告?

c# - 如何播放需要认证的视频流?

c++ 从宏到模板

c++ - 从 IIS 7.5 Web 应用程序调用 Win32 CreateEvent() 失败

c++ - GetOpenFileName lpstrInitialDir(目录)...不适用于 URL (SharePoint)

c++ - 提升精神 x3 int32 | double_ 无法解析 double

visual-c++ - Windows上的__block以便编译libdispatch

c# - 类库(适用于通用应用程序的可移植)System.Diagnostics.StackTrace 限制和引用针对另一个运行时的程序集

javascript - 为什么 WinJS 导航应用程序将 CSS 应用于任何访问的页面?