Microsoft’s Component Object Model, or COM, is a specification for developing modular software components. COM is not a programming language or an API, but an implementation of a component architecture. A component architecture is a method of designing software components so that they can be easily connected together, reused, or replaced without re-compiling the application that uses them. Other examples of this methodology include the Object Management Group’s Common Object Request Broker Architecture (CORBA) and Sun’s JavaBeans technologies.

IDL for Windows supports exposing a COM object as an IDL object. While COM components can be developed for numerous platforms, most COM-based software is written for Microsoft Windows platforms. IDL for Windows supports the inclusion of COM technologies, but IDL for UNIX does not. This section discusses COM in the context of Microsoft Windows exclusively.

What Are COM Objects?

A COM object, or component, is a piece of software that:

  • Is a library, rather than a stand-alone application (that is, it runs inside some sort of client application such as IDL, a Visual Basic application, or a Web browser)
  • Is distributed in a compiled, executable form
  • Exposes a group of methods and properties to its client application

COM objects controls are nearly always packaged as Windows executable (.exe), dynamic link library (.dll), or object linking and embedding (.ocx) files.

Why Use COM Objects with IDL?

There are several reasons to use COM technologies alongside IDL:

  • COM objects can be designed to use the facilities of the underlying Windows operating system. If you need access to Windows features not exposed within IDL, incorporating a COM object into your IDL program may provide the functionality you need.
  • COM objects have been written to provide custom user interface elements or accomplish specific tasks. Many of these components are available to you free or at minimal cost. If you work exclusively in a Windows environment, incorporating a pre-written component in your IDL program may be faster than coding the same functionality in IDL.

Exposing a COM Object as an IDL Object

IDL’s IDLcomIDispatch object class creates an IDL object that communicates with an underlying COM object using the COM object’s IDispatch interface. When you create an IDLcomIDispatch object, you provide the identifier for the COM object you wish to use, and IDL handles instantiation of and communication with the object. You can call the COM object’s methods and get and set its properties using standard IDL object conventions and syntax.

For details on using the IDLcomIDispatch object class to incorporate COM objects into your IDL applications, see Using COM Objects in IDL.