What is DISPATCH?

The DISPATCH INTERFACE is a slower form of interface, originally introduced as a part of Microsoft Visual Basic.  An implementation of COM DISPATCH support was introduced in a prior version of PowerBASIC. It has now been substantially improved to offer COM SERVER as well as client support, Dual Interfaces, relaxed typing, exception information, and much more.

When you use DISPATCH, the compiler actually passes the name of the METHOD you wish to execute as a text string.  The parameters can also be passed in the same way.  The object must then look up the names, and decide which METHOD to execute, and which parameters to use, based upon the text strings provided.  As if that weren't enough, DISPATCH requires that all parameters and return values be passed as VARIANT variables, with all those conversions the responsibility of the programmer.  That's right, you.  This is a slow process.  However, DISPATCH is flexible, convenient, and forgiving.  Further, you'll find that many scripting languages and application use DISPATCH as their sole method of operation, so continued support is absolutely necessary.

 

See Also

What is an object, anyway?

Just what is COM?

Late Binding

ID Binding