InvokeObject Function
Prototype
Public Declare Function InvokeObject Lib "TclBridge.dll" (poObj As Object, ByVal psMemberName As String, ByVal plFlags As Long, pvArguments() As Variant, pvResult As Variant) As Long
Input
The "poObj" parameter, which is the object to invoke. The "psMemberName" parameter, which is the name of the member to invoke. The "plFlags" parameter, which must be either vbMethod (1), vbGet (2), vbLet (4), or vbSet (8). The "pvArguments" parameter, which must be a one-dimensional array of variants with the proper number and type of arguments for the specified member.
Output
The "pvResult" parameter, which receives the result of invoking the member, if any.
Returns
A standard COM automation HRESULT (long integer).
COM Results
Not applicable.
Side Effects
Whatever the object method does.
Description
This function is used as an alternative to the "CallByName" function provided with Microsoft Visual Basic 6.0. It allows you to pass an arbitrary number of parameters. Parameters that are changed by the object are properly changed in the caller's parameter array. If the object cannot be invoked, the correct error code is returned (for example, DISP_E_PARAMNOTOPTIONAL, "Parameter not optional.").
Notes
In the event the object throws an exception, the extended exception information is not returned.
The declaration for this function is in the "TclBridgeSupport" (TCLBSUPT.BAS) module.
Example
Private Sub Command1_Click()
    Dim plResult As Long
    Dim pvArguments() As Variant
    Dim pvResult As Variant

    plResult = InvokeObject(Me, "Name", vbGet, pvArguments(), pvResult)

    MsgBox "The result is: (" & plResult & ", " & pvResult & ")", vbInformation, App.Title

End Sub