windows - What's the difference between CoCreateInstance() and CoGetClassObject() when creating objects on the same machine? -
I understand that CoCreateInstance obtains a COM server for the given class ID, creates an object installation for that ID and The object that receives from an interface receives a COM server for example CoGetClassObject () class ID, creates an example of a class factory for that class ID and retrieves that class factory interface, which is then used to create the real object Can be Bengal.
How and how does this work differently when used to create an object on the same machine? Do they work in the same way, but only cause the same com server to apply different codes?
CoGetClassObject essentially gives you an indicator in a function for a particular interface. Under the hood, CoCreateInstance uses CoGetClassObject. The advantage of calling CoGetClassObject is that you can only create a factory once, if you want to create several instances of a specific object.
In the MSDN section on CoGetClassObject you can take advantage of this functionality, there is a brief discussion on this.
Comments
Post a Comment