Error opening file in Win10 Modern app launched from desktop C++

为君一笑 提交于 2019-12-10 19:25:12

问题


I'm trying to open an image file with the Windows 10 Photos app (which is a 'modern' app) from desktop C++ using the following code (error checks omitted for simplicity):

DWORD pid;
CComPtr<IApplicationActivationManager> paam;
CoCreateInstance(CLSID_ApplicationActivationManager, NULL, CLSCTX_LOCAL_SERVER, IID_PPV_ARGS(&paam));
CoAllowSetForegroundWindow(paam, NULL);
paam->ActivateForFile(pwszAppUserModelId, psia, L"open", &pid);

pwszAppUserModelId is the app user model ID for the Photos app. psia is a pointer to an IShellItemArray that contains a single IShellItem for an image file (PNG).

ActivateForFile is returning error 0x80270255:

'This app has multiple extensions registered to support the specified contract. Activation by AppUserModelId is ambiguous.'

Any tips on how to fix this? TIA.

来源:https://stackoverflow.com/questions/35395035/error-opening-file-in-win10-modern-app-launched-from-desktop-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!