COM - The Plumbing behind the Scenes

The Common Object Model (COM) is Microsoft's standard for object interaction. COM provides a standard mechanism by which objects and components can communicate, independent of the language in which the components were created.

Other major Windows technologies rely on COM to function. The two most notable of these technologies are OLE (Object Linking and Embedding) and ActiveX. These both use COM to facilitate all the interaction between objects. OLE uses COM to communicate between applications, allowing users to link or embed parts of one application's data and display into another application. ActiveX is broader, using COM to support communication between controls, in-process, and out-of-process servers.

Microsoft has designed Visual Basic to fit seamlessly into COM. Components created with Visual Basic are ActiveX components, which means that they use COM to communicate with each other and with their client programs. In many other languages, it can be very complex to create components that fit into this model, but Visual Basic takes care of all that complexity behind the scenes.

Distributed COM (DCOM) extends the communication capabilities across the network. With DCOM, any COM object can transparently communicate with objects on other machines over the network. This works with components created in Visual Basic as well, which means that Visual Basic developers can create objects and distribute them across the network with very little effort.

Visual Basic 5.0's object capabilities are very well matched to those of COM. COM objects typically have multiple interfaces and, as we've seen, Visual Basic objects can have multiple interfaces using the Implements keyword. COM, like Visual Basic, has no direct support for inheritance, but instead relies upon aggregation so we can group objects together to provide more complex functionality.

Because Visual Basic 5.0's capabilities are so closely matched with COM's capabilities, it is an ideal development tool when we're working in a COM environment.