COM Component is a compiled software component that is based on Microsoft’s Component Object Model (COM) technology. COM components generally refer to the physical files that contain the classes that define COM objects. COM components also include additional code, such as code to register the component in the registry and code for loading the component.
COM components can be written in many languages using tools such as Microsoft Visual Basic, Microsoft Visual J++, Microsoft Visual C++, and Microsoft Visual FoxPro. COM components can be run on an application server, a Web server, a Microsoft Transaction Server (MTS), or a client.
COM components can be stand-alone applications or reusable software components, and they make the development of Web applications comparable to the development of system applications.
How it works
COM components interact with each other and with user applications in a client/server fashion. The client, therefore, uses the functionality of the server component by creating instances of classes that the server component provides and calling their properties and methods.
COM components can be designed to run in three different modes:
- In-process: The component executes in the calling application’s process space.
- Local: The component executes in its own process space.
- Remote: The component executes in a process space on another machine.
An in-process COM component has the extension .ocx or .dll, while an out-of-process COM component (one running outside the calling application process) has the extension .exe. COM components can run on another machine in a manner transparent to the calling application by using the Distributed Component Object Model (DCOM).
When developing applications based on COM components, use in-process components to optimize the speed of object access, but use out-of-process components to maximize thread safety.