What is a Dispatch Interface?

The Dispatch Interface of a COM Object is another key COM definition.  Broadly speaking, a Dispatch Interface is the actual mechanism that is used by a COM-aware application to communicate with the COM Object.  In other words, an application communicates with a COM Object through its Dispatch Interface.

A Dispatch Interface can be represented in a similar manner to a User-Defined Type (UDT), but instead of member variables, an Object's Dispatch Interface members comprise a set of Functions and associated data.  See INTERFACE/END INTERFACE for more details of the actual syntax of an Interface representation, along with The PowerBASIC COM Browser for a tutorial on examining the interfaces of objects and generating an interface definition file.

A COM Object may offer an unlimited number of Interfaces, but may expose only one Dispatch Interface.  Internally, these Interfaces are exposed through the single Dispatch Interface.

A COM Object must support a Dispatch Interface to be used by PowerBASIC (and Visual Basic).  PowerBASIC does not currently support the use of Direct Interfaces.  Further, a PROGID and a CLSID must be present to uniquely identify each Dispatch Interface exposed by a COM Object.

 

See Also

COM Programming Introduction

Creating an early-bound object variable

The PowerBASIC COM Browser