1. 导入Microsoft ScriptControl到ActiveX
2. 实现一个自定义的对象IMyObject(Unit2)
3. 使用(Unit1),可用使用下面的脚本:
MyObject.ShowMsg("MyObject hello");
Count = 1000;
AddCount();
ShowMsg("Count=" + Count);
IE.Navigate("http://www.google.com");
unit Unit2;
{$WARN SYMBOL_PLATFORM OFF}
interface
uses
ComObj, ActiveX, ScriptTest_TLB, StdVcl, Dialogs;
type
TMyObject = class(TAutoObject, IMyObject)
protected
FCount: Integer;
function ShowMsg(const s: WideString): Integer; safecall;
function Get_Count: Integer; safecall;
procedure AddCount; safecall;
procedure Set_Count(Value: Integer)