Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CreateObject equivalent in C/C++? (COM Interop)

Tags:

c++

c

interop

com

What would the equivalent in C/C++?

like image 739
Newbie Avatar asked Feb 04 '10 19:02

Newbie


1 Answers

It's the CoCreateInstance() function.

It is convenient to use CoCreateInstance when you need to create only a single instance of an object on the local machine. If you are creating an instance on remote computer, call CoCreateInstanceEx. When you are creating multiple instances, it is more efficient to obtain a pointer to the class object's IClassFactory interface and use its methods as needed. In the latter case, you should use the CoGetClassObject function.

You'll need to #include <Objbase.h> and you'll need to link to ole32.lib

like image 138
VoidPointer Avatar answered Sep 23 '22 14:09

VoidPointer