我正在尝试使用“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 started在Windows Developer Center在 MSDN 上获取有关如何编写 Windows 运行时应用程序的概述。
关于c++ - 使用 "Photos metro application"显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28831134/