fmmain.pas

来自「多数代码可以直接在Delphi6和Delphi7环境下运行。部分涉及.NET技术」· PAS 代码 · 共 48 行

PAS
48
字号
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.

⌨️ 快捷键说明

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