locked
custom WRL component creation in C++ metro app RRS feed

  • Question

  • Hi

    I build a simple WRL componet by using template and add one method foo(). Then I add c++ metro style application in the same solution. In this c++ metro client, I add reference to my custom WRL component. 

    Now the issue comes, I use ActivateInstance or GetActivateFactory

    RoInitializeWrapper initialize(RO_INIT_MULTITHREADED);
           ComPtr<ICalculator> cal;
    HString::MakeReference(InterfaceName_Contoso_ICalculator).Get(),&cal);
    ComPtr<IActivationFactory> myActivationFac;
    HRESULT hr = GetActivationFactory(HString::MakeReference(RuntimeClass_Contoso_Calculator).Get(), &myActivationFac);

    hr is always return class not registered error.

    But, if I used the build in WRL component, then it's fine. I search entire forums and cannot find the answer and sample code.   Seems to me this is not support for c++ metro client. Please share your experience. 

    Thanks,

    SmoothConnection

    Tuesday, November 6, 2012 8:43 AM

Answers

  • Hi Jesse,

    thanks for reply. I need to use c++ metro client, not javascript. I found if I use cx, then I never has any issue. For WRL component this issue happens often. It seems it's related with winmd file and references. Some one has similar problem before.

    http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/5db9ed94-5ba9-4ba6-9231-41f78e55dc3d

    Cheers,

    -All smooth.

    Wednesday, November 7, 2012 7:24 AM

All replies

  • Hi,

    How about this sample codes for WRL component?
    http://code.msdn.microsoft.com/windowsapps/Windows-Runtime-Component-e3e1e38d

    Best regards,
    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 7, 2012 7:16 AM
  • Hi Jesse,

    thanks for reply. I need to use c++ metro client, not javascript. I found if I use cx, then I never has any issue. For WRL component this issue happens often. It seems it's related with winmd file and references. Some one has similar problem before.

    http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/5db9ed94-5ba9-4ba6-9231-41f78e55dc3d

    Cheers,

    -All smooth.

    Wednesday, November 7, 2012 7:24 AM