Msscriptcontrol.scriptcontrol component Instance Object properties
| Property name |
Type |
Note |
| Allowui |
BOOL |
Detects whether the user's interface element is allowed to run. If False, interface elements such as message boxes are not visible. |
| CodeObject |
Object |
The object that the script exposes to the host. Read-only. |
| Modules |
Modules |
The component library module that the host provides to the script. Read-only. (COM components usually provide the user with a collection of objects that can be left to the user two times in the form of object collection, one modules per collection) |
| Language |
String |
Sets or gets the language interpreted by the script engine, for example: VBScript, JScript. |
| Name |
String |
The name of the script engine. Read-only. |
| Procedures |
Procedures |
Returns a collection of procedures defined in a module |
| Sitehwnd |
HWND |
To display the UI's parent window handle in a script |
| State |
Enum |
Sets or returns the state of the control, and if 0, the control executes only the statement but does not forward the event, and for 1 the object that is accepted by the joined control. |
| Timeout |
Long |
The time-out value of the execution script for the control,-1 indicates no timeout |
| Usesafesubset |
BOOL |
Sets or returns whether the host program is concerned about security. The security level of the host program can be set from this property |
| Error |
Error |
Error object, when an error occurs, this property returns an Error object |
Msscriptcontrol.scriptcontrol Component Instance method name
| Method name |
Parameters |
Function |
| Addcode |
Code as String |
Add a script to the script engine to execute |
| AddObject |
Name as String, object as Object, [addmembers as Boolean = False] |
Add an object to the scripting engine so that the method provided by the object can be used in the script. |
| Eval |
Expression as String |
Evaluation of expressions |
| Executestatement |
Statement as String |
Interpreting and executing script statements |
| Reset |
|
Discard all objects and code, and set the state property to 0. |
| Run |
ProcedureName as String, ParamArray Parameters () as Variant |
To run a specified procedure |
Msscriptcontrol.scriptcontrol Component Instance event name
| Event name |
Function |
| Error |
Fires the event when an error occurs |
| TimeOut |
Occurs when the execution process times out |
How to use Msscriptcontrol.scriptcontrol
1. Add ScriptControl in the program
2. Define a ScriptControl instance
3, call Addcode and other methods to the script engine to add the script to execute.
4, call run execution to execute the script function.