Sets the property that is specified by the parameter.
HRESULT SetProperty( // The property value: uint dwProperty, // Not used: IntPtr pvarIndex, // The value of the property: out object pvarValue, );
The property value to set.
The value of the property.
The values allowed for
dwProperty are described in the following table.
|SCRIPTPROP_INTEGERMODE||0x00003000||Forces the scripting engine to divide in integer mode instead of floating point mode. The default value is
|SCRIPTPROP_STRINGCOMPAREINSTANCE||0x00003001||Allows the string compare function of the scripting engine to be replaced.|
|SCRIPTPROP_ABBREVIATE_GLOBALNAME_RESOLUTION||0x70000002||Informs the scripting engine that no other scripting engines exist to contribute to the global object.|
Returns one of the following values:
||An argument is not valid.|
||The call was not expected (for example, the scripting engine has not yet been loaded or initialized).|
To enable or disable integer division, invoke
SetProperty and convert a
Boolean to an
Object. By default, the property value is
False. If you set it to
True, division operations will return only integers.
To enable or disable custom string comparison, invoke
SetProperty and pass in an
Object value. The object that you pass in must implement the interface IActiveScriptStringCompare Interface. The StrComp method of the IActiveScriptStringCompare Interface interface is called every time that a string compare function is executed.
The following example shows how to force the scripting engine to use integer division and how to allow overloading of the compare function.
BMLScriptEngine bmlScriptEngine = new BMLScriptEngine(); IActiveScriptProperty scriptProperties = bmlScriptEngine as IActiveScriptProperty; // Force the scripting engine to use integer division. Boolean enableIntegerDivision = true; Object vtIntegerDivInstance = (Object)enableIntegerDivision; scriptProperties.SetProperty(SCRIPTPROP_INTEGERDIVISION, System.IntPtr.Zero, ref vtIntegerDivInstance); // Allow overloading of the compare function. BMLScriptStringCompare bmlScriptStringCompareInstance = new BMLScriptStringCompare(); Object vtStrCmpInstance = (Object)bmlScriptStringCompareInstance; scriptProperties.SetProperty(SCRIPTPROP_STRCOMPINST, System.IntPtr.Zero, ref vtStrCmpInstance);