packinfo.dpr

来自「《Delphi开发人员指南》配书原码」· DPR 代码 · 共 47 行

DPR
47
字号
program PackInfo;

uses
  SysUtils,
  Forms,
  Dialogs,
  PkgMain in 'PkgMain.pas' {PackInfoForm};

{$R *.RES}

var
  I: Integer;
begin
  // if no command line parameters are passed, present user with a
  // TOpenDialog from which to choose a package file
  if ParamCount = 0 then
  begin
    with TOpenDialog.Create(nil) do
    try
      Filter := 'Package files (*.bpl)|*.bpl|Delphi 3 Package (*.dpl)|*.dpl';
      DefaultExt := '.bpl';
      if Execute then PkgName := FileName;
    finally
      Free;
    end;
  end
  // if a command line parameter was passed, assume first parameter is
  // package file name
  else begin
    for I := 1 to ParamCount do
    begin
      if PkgName <> '' then PkgName := PkgName + ' ';
      PkgName := PkgName + ParamStr(I);
    end;
  end;
  // exit application if package file cannot be found
  if (PkgName = '') or not FileExists(PkgName) then
    MessageDlg(Format('File "%s" not found', [PkgName]), mtError, [mbOk], 0)
  else
  begin
    // If all goes well, run application
    Application.Initialize;
    Application.CreateForm(TPackInfoForm, PackInfoForm);
    Application.Run;
  end;
end.

⌨️ 快捷键说明

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