Execute

This command executes the COM object stored on the Windows CE device. Execute will first determine if the COM object has been loaded. If the object has not been loaded then Execute will attempt to load the object without events. If the object could be loaded successfully, the method executes. The object will remain loaded after this method completes execution.

The SysErr.Number object should be inspected to determine if Execute was successful.

Group: ce Object

Syntax: [bOK =] oMyObj.Execute(sMethod, [vParams])

bOK        (Boolean) Optional – the success or failure of the command.

sMethod  (String) Method is a text string that represents the method that you wish to execute.

vParams  (Variant) Optional – parameter array where you specify the parameters to the method. The parameters must be specified in the appropriate order that the method expects.

Example:

Dim bOK as Boolean

Dim oMyObj As DeviceObject

Dim vErr As Variant

Dim sParam1 As String

Dim sParam2 As String

Set oMyObj = New DeviceObject

oMyObj.Name = "DeviceObjectTest.ioInterface"

oMyObj.Create

sParam1 = "Value1"

sParam2 = "Value2"

bOK = oMyObj.Execute("Method1", sParam1, sParam2)

vErr = oMyObj.LastError

If vErr <> "" Then

  App.MsgBox "COM failure: " & CStr(vErr)

Else

  App.MsgBox "COM object returned: " & oMyObj.ReturnValue

End If

oMyObj.Release