0

I am busy porting an app to UWP, but I am coming across an issue with XPS support on Windows 10 Mobile.

When creating an instance of IXpsOMObjectFactory with the ID of CLSID_XpsOMObjectFactory, it gives me the return value of REGDB_E_CLASSNOTREG.

This is the code:

IXpsOMObjectFactory* fXpsFactory;

HRESULT hr = CoCreateInstance(
    CLSID_XpsOMObjectFactory,
    nullptr,
    CLSCTX_INPROC_SERVER,
    IID_PPV_ARGS(&fXpsFactory));

This works fine on the "desktop" machine, but when running on mobile - device and emulator - it errors.

I am doing a UWP app - I just created a new Universal C++ app and stuck the code in the main page. This code is part of a larger code base, so hopefully there is a solution that doesn't involve stacks of code changes.

Matthew
  • 4,832
  • 2
  • 29
  • 55
  • It seems like [IXpsOMObjectFactory](https://msdn.microsoft.com/en-us/library/windows/desktop/dd372509(v=vs.85).aspx) doesn't support on mobile. Please see the minimum support: Windows 7, Windows Vista with SP2 and Platform Update for Windows Vista [desktop apps | Windows Store apps] – Sunteen Wu Apr 01 '17 at 05:59
  • Thanks for that - forgot to check that section. Is there a way to check if a class is registered before creation? The creation logic lives in a constructor, so I can't just return false and use that - I was thinking a static pre-create check. – Matthew Apr 03 '17 at 14:23
  • Try [ApiInformation](https://learn.microsoft.com/en-us/uwp/api/windows.foundation.metadata.apiinformation) class. – Sunteen Wu Apr 05 '17 at 02:05
  • I don't think I can use `ApiInformation` to detect if a COM class has been registered. Or can it? – Matthew Apr 11 '17 at 02:56

0 Answers0