[Original] Senior Application of ScriptControl in Delphi (1)

xiaoxiao2021-03-06  42

Advanced Applications in ScriptControl in Delphi (1)

In our Windows system, we provide an OCX component called ScriptControl, and we can use this component to implement the wonderful world of script story.

1. Create a ScriptControl component service

First, let's take a look at what methods and properties have this component. Figure 001,002.

Figure 001

Figure 002

Next, we create component services with Delphi.

As can be seen from Fig. 001, the PROGID of the component is "MSScriptControl.ScriptControl

.1

"

. So we can create components like this:

VAR

SC: Olevariant;

Begin

SC: = CreateoleObject ('MsscriptControl.ScriptControl.1');

// Use the language property to set the language used by the component

// The language can be: VBScript, JavaScript (also abbreviated as JScript)

// Equivalent to