locked
custom COM instance in C++ metro app

    Question

  • Hi,

    I have a custom COM object I would like to instantiate in my metro app (c++).  As I understand, I need to include this COM object in the same solution and it must be reg free.  So the COM object must be added to my metro app as an isolated COM reference.  Then, when I call CoCreateInstance from within the metro app, it uses the local isolated object instead.  (Did I get this right?)

    But, it seems I cannot add a reference, to my metro app, which has an 'isolated' property.  I created several test apps to see which I could add this type of reference, and the only apps for which I could do this are C# (not metro) (see images below).  

    I've seen a number of posts which ask this question, and the answer is to use a regless COM object.

    So, did I miss something?  Is it possible or not to add an isolated COM reference to a metro app?  Or to put it another way, is it at all possible to instantiate a custom COM object in a c++ metro app?

    Thursday, December 06, 2012 6:29 PM

Answers

  • Hi Gary,

    You can instantiate custom COM objects in a Windows Store app in C++ by including it in the AppxPackage as registration free COM defined in the Application.manifest file and then loading it with CoCreateInstanceFromApp (you cannot call CoCreateInstance in a Windows Store app).

    --Rob

    • Proposed as answer by Jesse Jiang Thursday, December 13, 2012 3:01 AM
    • Marked as answer by Jesse Jiang Monday, December 17, 2012 7:24 AM
    Saturday, December 08, 2012 3:26 AM
    Owner

All replies

  • Hi Gary,

    You can instantiate custom COM objects in a Windows Store app in C++ by including it in the AppxPackage as registration free COM defined in the Application.manifest file and then loading it with CoCreateInstanceFromApp (you cannot call CoCreateInstance in a Windows Store app).

    --Rob

    • Proposed as answer by Jesse Jiang Thursday, December 13, 2012 3:01 AM
    • Marked as answer by Jesse Jiang Monday, December 17, 2012 7:24 AM
    Saturday, December 08, 2012 3:26 AM
    Owner
  • Hi Rob,
    I searched several times in the manifest description.
    I couldn't find a xml-tag or section of "AppxPackage as registration free COM" in the description of the Application.manifest file.
    Could you tell me (example of a manifest file), what I must write in the manifest so that I can load a registration free COM C# DLL.
    --Thomy


    Saturday, January 26, 2013 1:46 PM