In most cases, you can use CoCreateInstance and forget about CoGetClassObject.Function CoGetClassObject returns the pointer to the desired component’s classfactory and not the component itself. The desired component is created using thethe pointer returned from the function CoGetClassObject while theCoCreateInstance returns the requested interface pointer to that component (itcreates the component using IClassFactory internally).
However, there are two cases where you should use CoGetClassObject instead ofCoCreateInstance. First, you must use CoGetClassObject if you want to createobject using a creation interface other than IClassFactory (say if you want touse IClassFactory2). Second, if you want to create a bunch of components at the same time, it is more efficient to create the class factory for all of thecomponents instead of creating and releasing the class factory for everyinstance of a component.