Chapter 2. COM Basics

The components that will be developed in this book are in-process COM servers that run in the address space of Explorer, Internet Explorer, or both. Therefore, a discussion of COM, as it relates to the task ahead, is in order. Because the components are in-process, every aspect of COM will not be discussed (e.g., marshalling). The focus is the fundamental principles of COM in Visual Basic terms. And the goal is to present these concepts in a simple and straightforward manner, with the hope that you will understand the components you create in Visual Basic a little better.

What Is COM?

COM is an architecture. It is a standard for developing components that can interact with each other, regardless of the language in which they were written. This means that components that are written in C++, Java, and VB can all work together unaware of the language in which the other was written. This happens because COM is a binary standard. Simply put, when a COM component is loaded into memory, it looks a certain way. It’s that simple. COM defines the rules that components use to interact with each other and the outside world. It is not a language. But any language that can call a function through a pointer can be used to write COM components.

A language like C++ offers a source code standard. This allows C++ programmers to reuse code at the source level. In other words, it provides the means for source code reusability. COM, on the other hand, has a much loftier goal. It ...

Get VB Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.