DLL文件源代码如下,如果能给出详细步骤,再开帖100分酬谢!!决不食言!!library D_Dll;uses
  SysUtils,
  Classes;{$R *.res}function GetName(Type: Word): string; stdcall;
begin
  if Type = 0 then
    Result := 'a'
  else
    Result := 'b';
end;exports
  GetName;end.

解决方案 »

  1.   

    新增一個ActiveX Library類型的項目, 然後, 在裹面的 type library
    中增加一個方法的定義, 
    實現完後註冊下
    應該也不難
      

  2.   

    參考<<delphi6 開發人員指南>>
      

  3.   

    启动delphi 关闭所有工程 然后:
    New->Activex->Active Library
    New->Activex->Transactional Object
    CoClass Name 输入你要的名字,例如DllCom
    Transaction Model:
    选择Supports Transactions :支持事务
    ->OKtype library
    Transactional Object
    CoClass Name 输入你要的名字,例如DllCom
    Transaction Model:
    选择Supports Transactions :支持事务IDLLCom 又键->New->Method
    Name输入名字:GetName
    Parameters标签:
    Add 一个Parameter
    Name:vType Type:VARIANT Modifier:[IN]
    再Add 一个Parameter
    Name:VReturn Type:VARIANT* Modifier:[out, retval]
    然后点上面的刷新!找到Unit1 此时系统自动产生程序框架:
    function TDllCOm.GetName(vType: OleVariant): OleVariant;
    beginend;然后完成如下代码:
    function TDllCOm.GetName(vType: OleVariant): OleVariant;
    begin
      if vType=0 then
        Result := 'a'
      else
        Result := 'b';
    end;保存,并完全编译Run->Register Activex Server
    Run->Install COM+ Objects钩选DllCom->Install Into New Application -> 填写Application Name (如:MyDllCom) -> OK便完成了Server的编写调用:
    关闭所有delphi工程
    New->Application在form上放置一button,并Uses 刚才的XXX_LIB 单元
    并完成如下代码:
    procedure TForm1.Button1Click(Sender: TObject);
    var
      LoginObj:IDllCom;
    begin
      LoginObj:=CoDllCom.CreateRemote('你的IP地址');
      //LoginObj:=CoDllCom.CreateRemote('192.168.0.1');
      ShowMessage(LoginObj.GetName(0));
      //调用 LoginObj.GetName(0) 并回自动返回结果
    end;如果还不行,给我发消息
      

  4.   

    wozhuchuanwei(四库全输) 说全了都,没的说了
      

  5.   

    启动delphi 关闭所有工程 然后:
    New->Activex->Active Library
    New->Activex->Transactional Object
    CoClass Name 输入你要的名字,例如DllCom
    Transaction Model:
    选择Supports Transactions :支持事务
    ->OKtype library
    Transactional Object
    CoClass Name 输入你要的名字,例如DllCom
    Transaction Model:
    选择Supports Transactions :支持事务IDLLCom 又键->New->Method
    Name输入名字:GetName
    Parameters标签:
    Add 一个Parameter
    Name:vType Type:VARIANT Modifier:[IN]
    再Add 一个Parameter
    Name:VReturn Type:VARIANT* Modifier:[out, retval]
    然后点上面的刷新!找到Unit1 此时系统自动产生程序框架:
    function TDllCOm.GetName(vType: OleVariant): OleVariant;
    beginend;然后完成如下代码:
    function TDllCOm.GetName(vType: OleVariant): OleVariant;
    begin
      if vType=0 then
        Result := 'a'
      else
        Result := 'b';
    end;