Object variables are used to access an object. Object variables contain a pointer to the desired object, so they are considered to contain an "Object Reference". They contain no other value of any kind. Object variables are declared by the name of the interface they represent. This could be the generic IDISPATCH, IUNKNOWN, and IAUTOMATION interfaces, or one that is explicitly defined with an INTERFACE structure. For example:
' Generic IDispatch Object variable
DIM oWord AS IDISPATCH
LET oWord = NEWCOM "Word.Application"
' Generic IUnknown Object variable
DIM MyObj as IUNKNOWN
DIM oWord as Int_Application
LET MyObj = NEWCOM "Word.Application"
LET oWord = MyObj
' Interface-specific Object variable
DIM oWord AS Int_Application
LET oWord = NEWCOM "Word.Application"
An object variable may only be used in specific situations, such as
execution of an Object Method. It
is never legal to reference Object variables in normal
write:
CALL MyObject.abc()
See Also
How do you call a Direct Method?
How do you call a DISPATCH METHOD?