What It Is
COM is a technology from Microsoft that allows objects to communicate without the need for either object to know any details about the other, even the language it’s implemented in.
At the lowest level, COM deals with interfaces and objects and makes a clear distinction between an object’s interface and its implementation. The interface defines how an object is used, but the implementation of the interface is up to the object.
COM defines many interfaces but doesn’t provide implementations
for many of these interfaces. One commonly used interface,
IDispatch
, allows COM objects to be used from a
scripting environment, such as Visual Basic or Python. Although COM
has defined the interface for IDispatch,
it’s the responsibility of the COM objects themselves to
implement this interface, and exactly how they implement it depends
on the object model or functionality the COM object is trying to
expose.
Objects that implement the IDispatch interface are
known as automation objects. The rest of this chapter shows how to
use automation objects from Python, and then we show how to create a
COM object in Python and call from Visual Basic. Chapter 12 covers all these details in greater depth.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access