As mentioned in the previous section, QOLEOBJECT implements an automation controller. This component works similarly to VB (no, VB does not have a QOLEOBJECT component), except for a few things which are either implemented in another way or is not yet supported. Let's look at some examples comparing the 2 methods:
' Both examples invoke MS WORD
' in VB
DIM Obj AS OBJECT
Set Obj = CreateObject("Word.Basic")
' or just DIM Obj AS Word.Basic
Obj.AppShow
' in Rapid-Q
DIM Obj AS QOLEOBJECT
Obj.CreateObject("Word.Basic")
Obj.AppShow
Note that type checking is off for OBJECT and QOLEOBJECT, so when you invoke Obj.AppShow this calls the method AppShow in MS WORD. You may notice that Rapid-Q also supports the Invoke method. This is to eliminate ambiguity but also to provide a work around. So what if MS WORD has a method called CreateObject? In Rapid-Q this causes a problem since CreateObject is a valid method of QOLEOBJECT, so that method will be called, not the one in MS WORD. The work around is to use the Invoke method.
' in Rapid-Q
DIM Obj AS QOLEOBJECT
Obj.CreateObject("Word.Basic")
Obj.Invoke("CreateObject") ' Call CreateObject method in MS WORD
Obviously you shouldn't run the above example, MS WORD doesn't have a CreateObject method, but you get the idea. Setting and getting properties can be done similarly:
' in Rapid-Q
DIM Obj AS QOLEOBJECT
Obj.CreateObject("Gif89.Gif89.1")
Obj.AutoStart = 1
Obj.Invoke("AutoStart") = 1 ' this also works
So what's not supported in Rapid-Q? Several data types and arrays are not supported yet, as well as events. Also there isn't a "set" method available. ie:
' in VB
DIM ADOCommand AS ADODB.Command
DIM ADOConnection AS ADODB.Connection
set ADOCommand.ActiveConnection = ADOConnection
The line in red is not yet available in Rapid-Q. See the Appendix section on QOLEOBJECT, you will find a method called InvokeCopy which does the samething, but unfortunately isn't fully functional as of this writing.