简体   繁体   中英

Accessing COM Object from WinRT C++ Component

I would like to write a WinRT (C++) component that access my COM Object. in order to do that I need the COM Object Interface definitions, so I'm using #import with raw_interfaces_only

eg

#import "libid:ee10004c-2d77-4289-bb93-d6def17881dd" raw_interfaces_only

the problem is that I'm getting the following error on the autogenerate .tlh file:

fatal error C1075: '{': no matching token found

The same code works fine in regular windows console application.

According to this link COM Consuming is supported by WinRT, so it is not clear how can I import my Interface to WinRT C++ Project.

How do I import my COM Interfaces definition to my WinRT C++ Project?

Using midl.exe (included in Visual Studio) I was able to to generate a .H file that contains all of the definition and compile fine in WinRT component.

midle.exe myinterface.idl

this Generate header file that can be included in the WinRT Project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM