unit AboutBox;

interface

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

type
  TAboutForm = class(TForm)
    Image1       : TImage;
    lblVersion   : TLabel;
    lblCopyright : TLabel;
    btnAboutOK   : TBitBtn;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  AboutForm: TAboutForm;

implementation

uses ladderu;

{$R *.DFM}

procedure TAboutForm.FormCreate(Sender: TObject);
const
  cFV = '\StringFileInfo\040904E4\FileVersion';
  cFC = '\StringFileInfo\040904E4\LegalCopyright';
VAR
  viSize, Dummy, Len : Integer;
  viBuff, viP        : Pointer;
  viS                : PChar;
begin
  Left := Application.Mainform.Left;
  IF Left+Width > Screen.Width THEN
    Left := Screen.Width - Width;
  Top := Application.Mainform.Top;
  Image1.Picture := MainForm.Image1.Picture;
  // Put version info into about box
  viSize := GetFileVersionInfoSize(PChar(Application.ExeName),Dummy);
  GetMem(viBuff, viSize);
  try
    GetFileVersionInfo(PChar(Application.ExeName),0,viSize,viBuff);
    IF (NOT VerQueryValue(viBuff, cFV, viP, Len)) OR (Len<8) THEN
      lblVersion.Caption := 'PC Ladder'
    else
      begin
        viS := StrNew(PChar(viP));
        try
          lblVersion.Caption := Format('PC Ladder - version %s',
            [viS]);
        finally
          StrDispose(viS);
        end;
      end;
    IF (NOT VerQueryValue(viBuff, cFC, viP, Len)) OR (Len<10) THEN
      lblCopyright.Caption := 'Copyright © 1998 Ziff-Davis '+
        'InC.'
    else
      begin
        viS := StrNew(PChar(viP));
        try
          lblCopyright.Caption := StrPas(viS);
        finally
          StrDispose(viS);
        end;
      end;
  finally
    FreeMem(viBuff);
  end;
end;

end.




