c++ - COM automation using tlb file -


Please refer to the newbie for windows environment and com programming.

I have to automate an application (aka) access. The daughter exposes himself as a com server and provides the CANoe.h, CANoe_i.c, and the CANoe.tlb file. To reach the object, no one can specify the C ++ client to write.

Also, please specify how to use the code contained in the TLB file from C ++.

Import the type libraries into your C ++ project in Visual Studio and use the defined objects as Too many built in support. For example, you can use the #import directive:

  #import "CANoe.tlb"  

this It will import type of library, and converts it to headers to files and implementation files - this will also implement the implementation files due to the implementation of your project and the header files to be included, so it's a lot of magic The stuff is fine.

After that, you type many types for smart pointer rappers for types and objects that are defined in the type libraries. For example, if there is a code called app which implements the interface IApplication , then you can:

  ApplicationPtr app (__ uuidof (application));  

At the time of this walk, the coke application can be made and the variable can be bound to the app , and you can call it this way :

  app-> gt; DoComeCoolStuff ();  

In order to handle the error, it is done by checking the results of the COM calls and throwing the appropriate _com_error exception as needed, so that means you have to type exceptions safely.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -