Just what is COM?

COM is an acronym.  It represents the words "Component Object Model".

The short answer is that COM defines a way to communicate between modules of code.  The slightly longer answer follows.

You should know that every object created or defined in PowerBASIC is fully compatible with the COM specification.  Many popular compilers are not able to make that claim accurately.  The COM specification defines a standardized method of communication between modules of code (frequently called components), regardless of the platform or the tool used to create them.  COM components are reusable chunks of code and associated data, which may be accessed by other "COM-Aware" components and applications.

One of the most frustrating things about this technology has been the ever-changing list of buzz-words used to describe it.  We've evolved through OLE, VBX, and OCX, to COM, ActiveX, and more.  Though nuances of difference abound, the important thing to remember is that COM and ActiveX describe a means of accessing code and data located outside of the current module.  COM+ refers to some extensions which are specific to Win2000, WinXP, and WinVista.  Throughout this discussion, we'll use the terms COM Object and ActiveX Object to describe components: reusable chunks of code and associated data.

Prior versions of PowerBASIC introduced client COM services, which were accessible through the COM DISPATCH interface.  While the DISPATCH interface is very flexible and easy-to-use, that very flexibility adds a level of overhead which is unacceptable for many applications.  This version of PowerBASIC adds the capability to create and access COM objects through a DIRECT INTERFACE or a DISPATCH INTERFACE.

All objects in PowerBASIC, COM or not, follow all the guidelines and implementation rules established for COM Objects.  This simplifies usage by the programmer, yet adds no measurable overhead at run-time. PowerBASIC encapsulates all the low-level details of the actual COM communication process.  This provides a straightforward way to load and communicate with a COM component using BASIC syntax.  You'll find that the PowerBASIC object implementation is very efficient, with virtually no degradation of execution speed as compared to standard Subs and Functions.

The PowerBASIC Console Compiler can only create internal objects, COM and ActiveX objects can be created with the PowerBASIC For Windows Compiler.

 

See Also

What is an object, anyway?

What is a COM component?

How do you publish an object?

How are GUID's used with objects?