用delphi建立一个dll都没问题就是不知道如用在作法时如何加进参数(in,out)在asp里老提示类型不对,还有如何作function向asp里传值下面有一个 check的function但在asp里不让调动出刹求求各位高手这个问题困扰了我好久unit Unit1;{$WARN SYMBOL_PLATFORM OFF}interfaceuses
  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.

解决方案 »

  1.   

    用错了
    应该用asp对象,而且不要选onpagestart/.....unit Unit1;{$WARN SYMBOL_PLATFORM OFF}interfaceuses
      ComObj, ActiveX, AspTlb, Project1_TLB, StdVcl;type
      Ttest = class(TASPMTSObject, Itest)
      protected
        procedure Method1(p1: OleVariant; out p2: OleVariant); safecall;
      end;implementationuses ComServ;procedure Ttest.Method1(p1: OleVariant; out p2: OleVariant);
    begin
      // your source
    end;initialization
      TAutoObjectFactory.Create(ComServer, Ttest, Class_test,
        ciMultiInstance, tmApartment);
    end.
      

  2.   

    还是不行在asp里这样调用<%
    set obj=server.createobject("project1.hhh")
    obj.method1 "1",a        '出错信息是"对象不支持此属性或方法 method1"%>为什么在type libary 中不显示method1
      

  3.   

    dll注册了吗?
    如果用regsvr32注册的,注意每次更新的时候要重启iis
    如果注册为com+,要重新注册