使用下面代码定义定义一个接口,对吗?如何使用编译后的 DLL unit Unit1;interfaceuses
  Windows, ActiveX, Classes, ComObj,dialogs;type
  TcomDemo = class(TComObject)
  protected
    procedure showmsg;
  end;const
  Class_comDemo: TGUID = '{1A8198E0-CBE1-11D7-AFDF-080039015EB3}';implementationuses ComServ;procedure TComDemo.showmsg;
begin
  showmessage('Demo');
end;initialization
  TComObjectFactory.Create(ComServer, TcomDemo, Class_comDemo,
    'comDemo', '', ciMultiInstance, tmApartment);
end.

解决方案 »

  1.   

    你的接口在那里?我没有看到啊!Class_comDemo仅仅是一个GUID。
      

  2.   

    我看到的几个例子 都使用*_tlb.dcu。客户端例子使用*_tlb.dcu。
    我现在不想使用这种方式。使用这种方式,发布客户端程序时,*_tlb.dcu 也要发布吗?
      

  3.   

    你这不是定义接口,是实现接口。
    编译好的DLL可以通过 regsvr32 来注册,也可以通过安装工具(如InstallShield)来注册。
    不需要发布*_tlb.dcu
      

  4.   

    那 在 Delphi 中怎样使用此 DLL 中的 COM对象??
      

  5.   

    点击菜单 project | import type library
    然后在import type library窗口中点击Add按钮选择DLL。
    这个DLL必须是已经注册过的。