用delphi为asp写dll的问题非熟悉都未入

ttt2 2003-08-22 06:46:47
用delphi建立一个dll都没问题就是不知道如用在作法时如何加进参数(in,out)在asp里老提示类型不对,还有如何作function向asp里传值下面有一个 check的function但在asp里不让调动出刹求求各位高手这个问题困扰了我好久

unit Unit1;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
ComObj, ActiveX, Project1_TLB, StdVcl,ASPTypeLibrary_TLB;

type
Thhh = class(TAutoObject, Ihhh)
private
m_scriptContext:IScriptingContext;
protected

procedure onpageend; safecall;
procedure onpagestart(const unk: IUnknown); safecall;
procedure test(value1: SYSINT); safecall;
function check:olevariant; safecall;
{ Protected declarations }
end;

implementation


uses ComServ ;

function Thhh.check():olevariant;
begin
result:='aaa';
end;

procedure Thhh.onpageend;
begin
m_scriptContext := nil;
end;

procedure Thhh.onpagestart(const unk: IUnknown);
begin
m_scriptContext := unk as IScriptingContext;
end;

procedure Thhh.test(value1: SYSINT);
begin
m_scriptContext.Response.Write(value1);
end;

initialization
TAutoObjectFactory.Create(ComServer, Thhh, Class_hhh,
ciMultiInstance, tmApartment);
end.
...全文
118 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ttt2 2003-08-25
  • 打赏
  • 举报
回复
我已经搞定
fhuibo 2003-08-24
  • 打赏
  • 举报
回复
用ActiveFormX吗?
liumengchuan 2003-08-23
  • 打赏
  • 举报
回复
dll注册了吗?
如果用regsvr32注册的,注意每次更新的时候要重启iis
如果注册为com+,要重新注册
ttt2 2003-08-23
  • 打赏
  • 举报
回复
还是不行在asp里这样调用

<%
set obj=server.createobject("project1.hhh")
obj.method1 "1",a '出错信息是"对象不支持此属性或方法 method1"

%>

为什么在type libary 中不显示method1
liumengchuan 2003-08-22
  • 打赏
  • 举报
回复
用错了
应该用asp对象,而且不要选onpagestart/.....

unit Unit1;

{$WARN SYMBOL_PLATFORM OFF}

interface

uses
ComObj, ActiveX, AspTlb, Project1_TLB, StdVcl;

type
Ttest = class(TASPMTSObject, Itest)
protected
procedure Method1(p1: OleVariant; out p2: OleVariant); safecall;
end;

implementation

uses ComServ;

procedure Ttest.Method1(p1: OleVariant; out p2: OleVariant);
begin
// your source
end;

initialization
TAutoObjectFactory.Create(ComServer, Ttest, Class_test,
ciMultiInstance, tmApartment);
end.
ttt2 2003-08-22
  • 打赏
  • 举报
回复
d
ttt2 2003-08-22
  • 打赏
  • 举报
回复
d

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧