Executes a COM object's method.

Syntax

Result = SRP_Com(Object, "CALL", Name, [Param1, ..., Param16])

Returns

The method's return value.

Remarks

The CALL service calls an object's method. The Object parameter identifies the instantiated object whose method you wish to call. The Name parameter is the name of the method and is not case sensitive. The remaining parameters passes as parameters to the method.

When dealing with ActiveX controls in OpenInsight, you call methods using the Send_Message method. It gets tricky when you have to pass more than four parameters, as you have to pass them in a dynamic array, like so:

Send_Message(Ctrl, "Sum":@FM:1, 10:@FM:20:@FM:30:@FM:40:@FM:50:@FM:60)

SRP_Com supports up to sixteen individual parameters (more can be added as needed), so the code is more readable and easy to remember:

SRP_Com(Ctrl, "CALL", "Sum", 10, 20, 30, 40, 50, 60)

Note also that, unlike the other services, the CALL service does not have a success/failure return value. Instead, it simply returns the any value returned by the method. You can still use the ERROR service to determine if there was an error, particularly if an unexpected null value is returned. Note, however, that not all methods return a value, in which case a null value is returned.

Example

// Instantiate the MSXML DOM Document object
 If SRP_Com(objXmlDoc, "CREATE", "Msxml2.DOMDocument") then
     // Load the xml
     rv = SRP_Com(objXmlDoc, "CALL", "loadXML", Xml)
     // Release the object when we're done with it
     SRP_Com(objXmlDoc, "RELEASE")
 end else
     Error = SRP_Com("", "ERROR")
 end
  • No labels