locked
Return E_ACCESSDENIED when call CoCreateInstance

    Question

  • I programmed a COM with ATL of VS 2011, and when I called CoCreateInstance to this COM object in a metro style project, it always return E_ACCESSDENIED.

    Is there a restrict that metro style project cannot call custom COM object?

    Tuesday, October 11, 2011 5:38 AM

Answers

  • Metro style apps should call CoCreateInstanceFromApp.

    However, even that will fail because Metro style apps cannot call into custom-created classic COM objects that are globally registered.  You should either try to create a WinRT component (instead of a COM object) and include it in your app package

    Or, you can try creating reg-free COM components that your app can use.

    Thanks,

    Raman Sharma, Visual C++

    Tuesday, October 11, 2011 5:41 PM

All replies

  • Metro style apps should call CoCreateInstanceFromApp.

    However, even that will fail because Metro style apps cannot call into custom-created classic COM objects that are globally registered.  You should either try to create a WinRT component (instead of a COM object) and include it in your app package

    Or, you can try creating reg-free COM components that your app can use.

    Thanks,

    Raman Sharma, Visual C++

    Tuesday, October 11, 2011 5:41 PM
  • You mean writing a WinRT wrapper which inside calls classic COM object?

    Thanks

     


    C--s
    Friday, October 14, 2011 6:37 AM
  • That's possible yes.  But, in this case I am suggesting that instead of creating a COM object using ATL, you should create a WinRT component using the template provided with VS.

    Friday, October 14, 2011 2:35 PM
  • You mean writing a WinRT wrapper which inside calls classic COM object?

    Thanks

     


    C--s

    May just be a lot easier to convert the COM project into a WinRT project.
    http://blog.voidnish.com
    Friday, October 14, 2011 3:09 PM
  • It is a system COM object(CLSID_BidiSpl) that i want to use.

    Unfortunately, it is marked as a Desktop only api in the header file( bidispl.h) by WINAP_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP).

     

    In that case, this can NOT be used in WinRT component right, Right? any other option available here?


    C--s
    Friday, October 14, 2011 10:11 PM
  • It is a system COM object(CLSID_BidiSpl) that i want to use.

    Unfortunately, it is marked as a Desktop only api in the header file( bidispl.h) by WINAP_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP).

     

    In that case, this can NOT be used in WinRT component right, Right? any other option available here?


    C--s

    Not the same functionality, but WinRT apps are expected to use the types in the Windows::Devices::Printers::Extensions namespace. It may not meet your needs though.
    http://blog.voidnish.com
    Saturday, October 15, 2011 12:41 PM
  • Two more namespaces that may help you:

    • Windows::Graphics::Printing
    • Windows::Graphics::Printing::Advanced

    http://blog.voidnish.com
    Saturday, October 15, 2011 12:43 PM
  • Yep, it does not meet my needs.


    CAT
    Monday, October 17, 2011 8:45 PM