我寫了一個測試的﹐基本的還可以﹐但不知道怎么加可以接受參數并返回值的方法﹐
比如一個加法函數
function addit(n1,n2):integer;
begin
result:=n1+n2
end;
怎么把它加到下面的代碼中﹖
下面是我的PAS文件。
unit Unit1;
interface
uses
ComObj, ActiveX, Project1_TLB, StdVcl,ASPTypeLibrary_TLB;
type
Ttestobj = class(TAutoObject, Itestobj)
protected
procedure hello
safecall;
procedure OnEndPage
safecall;
procedure OnStartPage(const unk: IUnknown)
safecall;
function Get_info: WideString
safecall;
{ Protected declarations }
private
m_scriptContext:IScriptingContext;
end;
implementation
uses ComServ;
procedure Ttestobj.hello;
begin
m_scriptContext.Response.Write('ActiveX Test For Delphi');
end;
procedure Ttestobj.OnEndPage;
begin
m_scriptContext := nil;
end;
procedure Ttestobj.OnStartPage(const unk: IUnknown);
begin
m_scriptContext := unk as IScriptingContext;
end;
function Ttestobj.Get_info: WideString;
begin
result:='Delphi Asp Test';
end;
initialization
TAutoObjectFactory.Create(ComServer, Ttestobj, Class_testobj,
ciMultiInstance, tmApartment);
end.