怎样用dll封装一个function让asp调用(100分)

  • 主题发起人 主题发起人 p2p
  • 开始时间 开始时间
P

p2p

Unregistered / Unconfirmed
GUEST, unregistred user!
unit WDReg_TLB;
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, StdVCL, Variants;
const
// TypeLibrary Major and minor versions
WDRegMajorVersion = 1;
WDRegMinorVersion = 0;

LIBID_WDReg: TGUID = '{7E7A6A5C-38BB-4921-9B67-AF4A3ABDF14A}';

IID_IRegObj: TGUID = '{D4F8D795-7B37-4209-B77D-A30D53A01DE9}';
CLASS_RegObj: TGUID = '{84C0F94E-D6CD-4447-B2F1-B00E2B4ACE3E}';
type
IRegObj = interface;
IRegObjDisp = dispinterface;
RegObj = IRegObj;


IRegObj = interface(IDispatch)
['{D4F8D795-7B37-4209-B77D-A30D53A01DE9}']
procedure OnStartPage(const AScriptingContext: IUnknown); safecall;
procedure OnEndPage; safecall;
function GetSerialNO: string; safecall;
end;

IRegObjDisp = dispinterface
['{D4F8D795-7B37-4209-B77D-A30D53A01DE9}']
procedure OnStartPage(const AScriptingContext: IUnknown); dispid 201;
procedure OnEndPage; dispid 202;
function GetSerialNO: string; dispid 203;
end;
CoRegObj = class
class function Create: IRegObj;
class function CreateRemote(const MachineName: string): IRegObj;
end;

implementation

uses ComObj;

class function CoRegObj.Create: IRegObj;
begin
Result := CreateComObject(CLASS_RegObj) as IRegObj;
end;

class function CoRegObj.CreateRemote(const MachineName: string): IRegObj;
begin
Result := CreateRemoteComObject(MachineName, CLASS_RegObj) as IRegObj;
end;
end.

unit RegObj;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
ComObj, ActiveX, AspTlb, WDReg_TLB, StdVcl;

type
TRegObj = class(TASPObject, IRegObj)
protected
procedure OnEndPage; safecall;
procedure OnStartPage(const AScriptingContext: IUnknown); safecall;
function GetSerialNO: string; safecall;
end;

implementation

uses ComServ;

procedure TRegObj.OnEndPage;
begin
inherited OnEndPage;
end;

procedure TRegObj.OnStartPage(const AScriptingContext: IUnknown);
begin
inherited OnStartPage(AScriptingContext);
end;

function TRegObj.GetSerialNO: string;
begin
Result := 'OK';
end;

initialization
TAutoObjectFactory.Create(ComServer, TRegObj, Class_RegObj,
ciMultiInstance, tmApartment);
end.

MyRegObj.asp
<HTML>
<BODY>
<TITLE> Testing Delphi ASP </TITLE>
<CENTER>
<H3> You should see the results of your Delphi Active Server method below </H3>
</CENTER>
<HR>
<%
Set DelphiASPObj = Server.CreateObject("WDReg.RegObj")
dim s
s=DelphiASPObj.GetSerialNO
Response.Write s
%>
<HR>
</BODY>
</HTML>
请问高手我哪里写错了,在线等待!
 
TStringGrid怎麼使某一格顯示不同的顏色

http://www.delphibbs.com/delphibbs/dispq.asp?lid=2409837
 

Similar threads

I
回复
0
查看
714
import
I
I
回复
0
查看
570
import
I
I
回复
0
查看
613
import
I
后退
顶部