unit uAbout;

interface

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


type
  TfrmAbout = class(TForm)
    Panel2: TPanel;
    Panel3: TPanel;
    Label2: TLabel;
    lblURL: TLabel;
    lblCopyright: TLabel;
    Image2: TImage;
    Image1: TImage;
    Bevel1: TBevel;
    label1: TLabel;
    lblVersion: TLabel;
    btnOK: TBitBtn;
    procedure lblURLClick(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  procedure ShowAbout;

var
  frmAbout: TfrmAbout;

implementation

{$R *.DFM}

procedure ShowAbout;
begin
  frmAbout := TfrmAbout.Create(nil);
  try
    frmAbout.ShowModal;
  finally
    frmAbout.Release;
  end;
end;

function GetVersion: string;
 var
   VerValue:     PVSFixedFileInfo;
   VerInfo:      Pointer;
   VerInfoSize, VerValueSize, lpdwHandle: DWORD;
 begin
   VerInfoSize := GetFileVersionInfoSize(PChar(ParamStr(0)), lpdwHandle);
   GetMem(VerInfo, VerInfoSize);
   GetFileVersionInfo(PChar(ParamStr(0)), 0, VerInfoSize, VerInfo);
   VerQueryValue(VerInfo, '\', Pointer(VerValue), VerValueSize);
   with VerValue^ do
       Result := inttostr(dwFileVersionMS shr 16)+
                 '.'+inttostr(dwFileVersionMS and 65535)+
                 '.'+inttostr(dwFileVersionLS shr 16)+
                 '.'+inttostr(dwFileVersionLS and 65535);
   FreeMem(VerInfo, VerInfoSize);
 end;


procedure TfrmAbout.lblURLClick(Sender: TObject);
begin
  ShellExecute(handle, 'OPEN',PChar('http://www.shrubware.com'),'','',SW_SHOWDEFAULT);
end;

procedure TfrmAbout.FormCreate(Sender: TObject);
begin
  lblVersion.Caption := GetVersion;
end;

end.
