unit fmMain;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, ExtCtrls, pAggregateDemo_TLB;

type
  TForm1 = class(TForm)
    LabeledEdit1: TLabeledEdit;
    LabeledEdit2: TLabeledEdit;
    BitBtn1: TBitBtn;
    BitBtn3: TBitBtn;
    procedure BitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

uses ComObj;

procedure TForm1.BitBtn1Click(Sender: TObject);
var
  aIntf : IController;
  sName : WideString;
begin
  aIntf := CoController.Create;
  try
    OleCheck(aIntf.GetName(sName));
    Self.LabeledEdit1.Text := sName;
    OleCheck(aIntf.GetInnerName(sName));
    Self.LabeledEdit2.Text := sName;
  finally // wrap up
    aIntf := nil;
  end;    // try/finally
end;

end.
