|< BACK  NEXT >|
In this chapter, we looked at how to implement COM servers and COM clients.
Implementing a COM server requires the following:
For every COM class (coclass), an implementation class has to be developed. The implementation class supports one or more interfaces.
The implementation class should also support IUnknown and should abide by the rules of QueryInterface.
For every coclass, a class object has to be created. The class object typically supports interface IClassFactory to let the clients create instances of the implementation class.
The server code has to implement logic for registering and unregistering the server.
The server code has to deal with the lifetime management of the objects it creates.
We saw that the framework provided by ATL takes care of most of the grunge work.
A COM server can also reuse a third-party component using containment or aggregation. We looked at how ATL simplifies developing a component that supports aggregation.
In developing a COM client, the client has to follow certain rules of reference counting. We saw how ATL, as well as Visual C++ native COM support, can simplify client programming.
Finally, we looked at how to provide better error messages from the server to the client.
This chapter and the previous chapters built the foundation of COM, which is also the foundation of COM+. It is very difficult to determine where COM ends and COM+ begins. Any COM-related technology could also be referred to as COM+ technology. Hence, I may interchange the terms COM and COM+. At places where I explicitly wish to indicate a COM technology prior to Windows 2000, I will refer to it as classic COM.
In the chapters to follow, we will look at the facilities provided by COM+ in developing enterprise systems.
|< BACK  NEXT >|