Gets a COM object's property value.

Syntax

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

Returns

The object's property value.

Remarks

The GET service gets a property value. The Object parameter identifies the instantiated object whose property you wish to get. The Name parameter is the name of the property to get and is not case sensitive.

For indexed parameters, simply pass the requisite index values immediately following the Name parameter. Note that this is different from OpenInsight's Get_Property method, in which indexes are passed within square brackets following the property name. For example, you might get the first item of a property using OpenInsight's Get_Property like so:

Value = Get_Property(Ctrl, "Items[1]")

The same code using SRP_Com looks like this:

Value = SRP_Com(Object, "GET", "Items", 1)

Note also that, unlike the other services, the GET service does not have a success/failure return value. Instead, it simply returns the property value. You can still use the ERROR service to determine if there was an error, particularly if an unexpected null value is returned.

Some properties return references to new objects. In this case, the return value is a new object handle, which you may use with SRP_Com to "drill down" into the returned object's properties and methods. The example below shows what this looks like.

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)
    // Check for a parsing error by getting the ParseError object
    objParseError = SRP_Com(objXmlDoc, "GET", "ParseError")
    If SRP_Com(objParseError, "GET", "ErrorCode") then
        Error = SRP_Com(objParseError, "GET", "Reason")
    end else
        // Parsing succeeded
    end
    // Release the ParseError object we got earlier
    rv = SRP_Com(objParseError, "RELEASE")
    // Release the object when we're done with it
    SRP_Com(objXmlDoc, "RELEASE")
end else
    Error = SRP_Com("", "ERROR")
end
  • No labels