Creating a DISPATCH Object

DISPATCH objects are easy to create.  The technique is virtually identical to that for direct interfaces.  You must first declare the object variable -- if you wish to use "Late Binding", you'll use the generic name IDISPATCH.

LOCAL DispVar AS IDISPATCH
LET DispVar = NEWCOM "DispProgID"

If you wish to use "ID Binding", you'll use the interface name from your Interface IDBIND structure.

LOCAL DispVar AS MyDispIfaceName
LET DispVar = NEWCOM "DispProgID"

If all went well, you now have an object!  (And an object reference in your object variable).  Of course, it's  always a good idea to use the ISOBJECT(DispVar) function to be certain that the operation was a success.  If it failed, an attempt to use the object variable could cause a fatal exception.

 

See Also

What is an object, anyway?

What is DISPATCH?

Late Binding

ID Binding

How do you call a DISPATCH METHOD?