Sets a COM object's property value.

Syntax

Result = SRP_Com(Object, "SET", Name, [Param1, ..., Param15,] Value)

Returns

1 if the object's property was set successfully, 0 if there was an error.

Remarks

The SET service sets a property value. The Object parameter identifies the instantiated object whose property you wish to set. The Name parameter is the name of the property to set and is not case sensitive. The value parameter is the new value to which the property will be set.

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

Set_Property(Ctrl, "Items[1]", "Hello, World.")

The same code using SRP_Com looks like this:

SRP_Com(Ctrl, "SET", "Items", 1, "Hello, World.")

Most properties do not use indexes, in which case the new property value immediately follows the property name, like so:

SRP_Com(Ctrl, "SET", "Caption", "Hello, World.")

The SET service also differs from Set_Property in its return value. Set_Property returns the property's previous value. The SRP_Com SET service returns a success/failure. If a zero is returned, use the ERROR service to determine why the property could not be set.

Example

// Instantiate the MSXML DOM Document object
 If SRP_Com(objXmlDoc, "CREATE", "Msxml2.DOMDocument") then   
     // Setup the DOM Document
     SRP_Com(objXmlDoc, "SET", "Async", 0)
     SRP_Com(objXmlDoc, "SET", "ValidateOnParse", 0)
     SRP_Com(objXmlDoc, "SET", "ResolveExternals", 0)
     // 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