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.
User contributions licensed under CC BY-SA 3.0