Object Data Types

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 IUnkonwn 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 numeric or string expressions, nor is it possible to even output their value without the use of the special new functions like OBJPTR.  Methods are executed by using an object variable with a Method name.  For example, to call the Method ABC in an interface represented by the object variable MyObject, you would

write:

CALL MyObject.abc()

 

See Also

What is an object, anyway?

Just what is COM?

How do you create an object?

How do you call a Direct Method?

How do you call a DISPATCH METHOD?

Late Binding

ID Binding