CoCimSafeArray5.CallObjectMethod (method)

Call a named method of another COM object and reciewes the result in this object.
Syntax: object.CallObjectMethod Object, MethodName, InputArguments
Object As object -
MethodName As String -
InputArguments As SAFEARRAY(VARIANT)* -
Description: Calls the named method of the passed object with the remaining arguments and asigns the method result to this object. The passed COM object must implement IDispatch for this method to work. If the returned value does not happen to be an array a single dimension array with one element will be created to hold it. The third parameter listed (InputArguments) in this method is actually a mechanism for passing a variable argument list. The scripting syntax for passing the argument list is to just use normal argument passing syntax as demonstrated in the example. Basic Scripts normal calling convention is to pass everything ByRef. Some automation servers do not handle these ByRef parameters well. If problems seem to occur try passing the parameters using ByVal as demonstrated in this example.


Private cimOleObj As Object
Sub OnKeyDown(key As Integer)
  Dim arResult As CoCimSafeArray5
  Set arResult = CreateObject("CIMPLICITY.CimSafeArray.5")
  ' Equivalant to arResult = cimOleObj.GetData2 "One", ByVal 2, ByVal 3
  arResult.CallObjectMethod cimOleObj, "GetData2", "One", ByVal 2, ByVal 3
  MsgBox "Element 1 = " & arResult.Element(0)
  MsgBox "Element 2 = " & arResult.Element(1)
  MsgBox "Element 3 = " & arResult.Element(2)
End Sub
See Also: SetObjectProperty , GetObjectProperty , GetObjectPropertyEx , SetObjectPropertyEx