locked
Calling system provided COM object from WinRT component gives 'Class Not Registered' error

    Question

  • I am writing a WinRT Component which creates a system provided COM object thru CoCreateInstance. Metro app successfully calls this WinRT object and underneath when winrt object calls CoCreateInstance, it will fail with Class Not Registered.

    I have checked regedit, coclass is registered.

    Any idea why?

    Thanks
    CAT
    Friday, October 28, 2011 1:50 AM

Answers

    1. If your interface is not in the list, then you cannot call that API from Metro style app
    2. No, you don't need to call CoInitializeEx from a C++ Metro style  app.  It is called implicitly for you at app startup time before any user code executes.

    Thanks
    Raman 

    Tuesday, November 01, 2011 12:31 AM

All replies

  • Have you checked that the COM object you are trying to call into is one of the following:

    http://msdn.microsoft.com/en-us/library/windows/apps/br205757(v=VS.85).aspx

    Activation of certain COM objects is blocked at runtime,  as opposed to Win32 API which can be blocked at compile time by just marking the header appropriately.

    Thanks
    Raman 

    Friday, October 28, 2011 6:59 PM
  • I don't find the interface in the list, however before using COM server, is CoInitializeEx to be called from metro style app.

    Thanks


    CAT
    Tuesday, November 01, 2011 12:16 AM
    1. If your interface is not in the list, then you cannot call that API from Metro style app
    2. No, you don't need to call CoInitializeEx from a C++ Metro style  app.  It is called implicitly for you at app startup time before any user code executes.

    Thanks
    Raman 

    Tuesday, November 01, 2011 12:31 AM
  • @Snekethan

    What COM component were you after? If you can provide a scenario where this would be useful for a Metro style app, it would be useful feedback for us to hear for future consideration.

    Thanks,

    -David

    Wednesday, November 02, 2011 3:28 PM
    Moderator
  • it is 'PrinterConfig.dll', CLSID_PrinterExtensionManager.
    CAT
    Saturday, November 05, 2011 12:56 AM
  • It appears that custom COM objects cannot be used naively from a Metro app. It appears that COM calls have to be made through a broker object and even from a custom WinRT component you cannot create an instance of you object unless the framework allows it. I see no way to extend the framework to do this and expect to see a not registered error if you try to do this (e.g., CoCreateInstance) from Metro. It would have been nice to be able to leverage the objects that are housed in desktop legacy servers and DLLs, but then there would be no way to control security and give the active metro app all the available resources in the system and limit power and CPU usage for the under lying background processes. If you need to do this then you will have to do it from a desktop app, which works fine in the cases that I have tested so far.

     


    • Edited by sb123123 Sunday, December 11, 2011 11:52 PM
    Tuesday, December 06, 2011 1:59 AM