Creating an ATL COM object that implements a specific interface

前端 未结 4 1061
面向向阳花
面向向阳花 2021-01-07 02:03

I need to implement a simple ATL COM object that implements a specific interface for which I have been given both a .tlb file and a .idl file. The interface is very simple

4条回答
  •  一个人的身影
    2021-01-07 02:28

    if you have a interface.tlb file, you can use

    #import "interface.tlb"
    

    to include it in a .cpp file, the compiler will convert the .tlb to a C++ style interface declaration. It creates a file called interface.tlh on the fly and then #includes it automatically.

    Then you use the usual C++ style code to write a class that implements the interfaces in the generated .tlh file.

提交回复
热议问题