IActiveScriptProperty::SetProperty
Updated: March 2009
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 values allowed for dwProperty are described in the following table.
|
Constant |
Value |
Meaning |
|---|---|---|
|
SCRIPTPROP_INTEGERMODE |
0x00003000 |
Forces the scripting engine to divide in integer mode instead of floating point mode. The default value is False. |
|
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. |
|
SCRIPTPROP_INVOKEVERSIONING |
0x00004000 |
Forces the JScript scripting engine to select a set of language features to be supported. The default set of language features supported by the JScript scripting engine is equivalent to the language feature set that appeared in version 5.7 of the JScript scripting engine. |
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. The StrComp method of the IActiveScriptStringCompare interface is called every time that a string compare function is executed.
To select the set of language features to be supported when the JScript scripting engine is initialized, invoke SetProperty and pass a value that corresponds to the language feature set to be enabled for SCRIPTPROP_INVOKEVERSIONING. If this property is set to 1 (SCRIPTLANGUAGEVERSION_5_7), the available language features are the same as those that appeared in version 5.7 of the JScript scripting engine. If it is set to 2 (SCRIPTLANGUAGEVERSION_5_8), the available language features are those that appeared in version 5.7 in addition to new features that were added in version 5.8. By default, this property is set to 0 (SCRIPTLANGUAGEVERSION_DEFAULT), which is equivalent to the language feature set that appeared in version 5.7, unless the host supports a different default behavior. For example, Internet Explorer 8 opts into the JScript language features that are supported by the version 5.8 JScript scripting engine by default when the default document mode for Internet Explorer 8 is "Internet Explorer 8 Standards" mode. Switching the Internet Explorer 8 document mode to Internet Explorer 7 Standards or Quirks mode resets the JScript scripting engine to support only the language feature set that existed in the version 5.7 JScript scripting engine.
Note:
|
|---|
|
SCRIPTPROP_INVOKEVERSIONING should be set only when the JScript scripting engine is being initialized. |
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);
- 5/20/2011
- Ted_
I would like to use Object.defineProperty().
- 8/19/2009
- Dolmen
Note: