home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / Runimage / Delphi50 / Demos / Corba / Account / Dii / accountclientdii.dpr
Encoding:
Text File  |  1999-08-11  |  1.3 KB  |  42 lines

  1. program AccountClientDII;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. {
  6.   This Console CORBA Client uses Dynamic Invocation Interface (DII) to
  7.   connect to the Server thereby using 'late binding'.
  8.   In order to run this client, follow these steps:
  9.   1. Export a CORBA IDL file using 'Export' button on AccountServer Type Library Form.
  10.      Save it as AccountServer.IDL
  11.   2. Start an Interface Repository (IR) by typing IREP TEST on command prompt.
  12.   3. Copy StdVCL.IDL from ($DELPHI)\Imports\IDL directory to current directory.
  13.   4. Import Account.IDL into the Interface Repository by typing
  14.       IDL2IR AccountServer.IDL -ir TEST
  15.   5. Run the AccountServer.Exe
  16.   6. Run this Client
  17. }
  18.  
  19. uses
  20.   SysUtils,
  21.   Windows,
  22.   CorbaObj;
  23. // Notice it does not use any _TLB, stub or skeleton units
  24.  
  25. var
  26.   AFactory, Account: TAny;
  27.   InstanceName: String;
  28.   Bal: Double;
  29. begin
  30.   try
  31.     InstanceName := ParamStr(1);
  32.     if InstanceName = '' then InstanceName := 'Jack B. Quick';
  33.     AFactory := ORB.Bind('IDL:AccountServer/AccountFactory:1.0');
  34.     Account := AFactory.CreateInstance(InstanceName);
  35.     Bal := Account.Balance;
  36.     CharToOEM(PChar(InstanceName), PChar(InstanceName));
  37.     WriteLn(Format('The balance on %s''s account is $%2f',[InstanceName, Bal]));
  38.   except
  39.     on E:Exception do WriteLn(E.Message);
  40.   end;
  41. end.
  42.