VC++编写的客户端,访问远端的服务器。我现在有TLB文件,我想自己写一个
软件,模拟以前的软件。
   IApplication = interface(IDispatch)
    ['{98AA9DD3-0715-4170-8A96-04F06C8BAD49}']
    procedure Connect(shType: Smallint; const bstrServerIP: WideString; const bstrUser: WideString; 
                      const bstrPass: WideString); safecall;
    procedure DisConnect; safecall;
    function IsConnect: Smallint; safecall;
    function GetSessions: IDispatch; safecall;
    procedure Exit; safecall;
    procedure ShowServer; safecall;
    function GetCurrentAccount: WideString; safecall;
    function GetCurrentHost: WideString; safecall;
  end;我自己
  private
    { Private declarations }
     econn : IApplication;
procedure TForm1.FormCreate(Sender: TObject);
begin
  econn := CreateComObject(CLASS_Application) as IApplication;   //CoApplication.Create;
  //esess := CoSession.Create;
  //esession := CoSessions.Create;
end;用ECONN.CONNECT(X,X,X,X)后没有办法连接服务器。我该咋办,是不是我的思路错了?
请指教.

解决方案 »

  1.   

    其实在Delphi里调用TLB文件很容易,只需要打开Project/import type library然后生成一个*_TLB.Pas文件就可以了。根本不用你那么麻烦,Delphi已经帮你写好了
      

  2.   

    也许我没有表达清楚。
    我已经导入了TLB文件,生成了*_TLB.PAS文件,上面的那一段就是*_TLB.PAS中的代码。
    我宣告了ECONN,后使用ECONN.CONNECT(*,*,*,*)没有办法连接到服务器,我使用SHOWSERVER
    就显示原来的软件界面。再就是GETSESSIONS:IDispatch咋调用。
    谢谢