A COM server and its objects do not stand alone. They exist to provide services to COM clients. A COM application contains both clients and servers.
Before accessing any COM services a client must call COM function
This call must be made in each client thread that accesses COM! For now we will only deal with single-threaded clients.
CoInitialize a client gets class factories, one for each type of COM object it wants to use, by calling
CoGetClassObject. The following Slideshow will step you through this process.
Once a client has an
pointer, it can call
to create an instance of the COM object and get its first interface pointer into the object.
When finished using the
pointer, a client calls
COM provides helper function CoCreateInstance
After releasing its COM interface pointers, a client calls
to tell COM that its thread will no longer access COM services or COM objects.