fdiiclientmain.pas

来自「就是这本书的随书代码。包括《实战Delphi 5.x-分布式多层应用系统篇》」· PAS 代码 · 共 58 行

PAS
58
字号
unit fDIIClientMain;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBClient, Grids, DBGrids, StdCtrls, Buttons, DBCtrls, ExtCtrls;

type
  TfrmDIIClientMain = class(TForm)
    BitBtn2: TBitBtn;
    ListBox1: TListBox;
    procedure BitBtn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmDIIClientMain: TfrmDIIClientMain;

implementation

{$R *.DFM}

uses CorbaObj;

procedure TfrmDIIClientMain.BitBtn2Click(Sender: TObject);
var
  cbDBServerFactory, cbDBServer : TAny;
  vEmployees : Variant;
  iCount : Integer;
begin
  try
    cbDBServerFactory := ORB.Bind('IDL:PDIIServer/CORBADIIServerFactory:1.0');
    cbDBServer := cbDBServerFactory.CreateInstance('');
    vEmployees := cbDBServer.Employees;
    if VarIsArray(vEmployees) then
    begin
      try
        ListBox1.Items.BeginUpdate;
        for iCount := VarArrayLowBound(vEmployees, 1) to VarArrayHighBound(vEmployees, 1) do
        begin
          ListBox1.Items.Add(vEmployees[iCount]);
        end;
      finally
        ListBox1.Items.EndUpdate;
      end;
    end;
  except
    on E:Exception do
      ShowMessage(E.Message);
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?