{
* The contents of this file are subject to the InterBase Public License
* Version 1.0 (the "License"); you may not use this file except in
* compliance with the License.
*
* You may obtain a copy of the License at http://www.Inprise.com/IPL.html.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License. The Original Code was created by Inprise
* Corporation and its predecessors.
*
* Portions created by Inprise Corporation are Copyright (C) Inprise
* Corporation. All Rights Reserved.
*
* Contributor(s): Krzysztof Golko.
}
unit frmuAbout;
interface
uses
{$IFDEF LINUX}
Types, QForms, QControls, QStdCtrls, QExtCtrls, QGraphics,
{$ENDIF}
{$IFDEF MSWINDOWS}
WinTypes, WinProcs, Forms, Controls, StdCtrls,
Buttons, Graphics, ExtCtrls, jpeg,
{$ENDIF}
frmuDlgClass, Classes, SysUtils;
type
TfrmAbout = class(TDialog)
Panel1: TPanel;
Image1: TImage;
Button1: TButton;
lblCopyright: TLabel;
lblOSVersion: TLabel;
lblIBConsoleVer: TLabel;
lblInterbaseLink: TLabel;
lblBorlandLink: TLabel;
procedure btnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure HTTPLinkClick(Sender: TObject);
procedure GetFileVersion (const Filename: String; out Major1, Major2, Minor1, Minor2: integer);
{ Private declarations }
public
{ Public declarations }
end;
procedure ShowAboutDialog(ProductName, ProductVersion: string);
implementation
uses
{$IFDEF MSWINDOWS}
ShellApi,
{$ENDIF}
IBCGlobal, zluUtility;
{$IF Declared(Forms)}
{$R *.DFM}
{$IFEND}
{$IF Declared(QForms)}
{$R *.xfm}
{$IFEND}
procedure ShowAboutDialog(ProductName, ProductVersion: string);
var
frmAbout: TfrmAbout;
begin
frmAbout := TfrmAbout.Create(Application.MainForm);
with frmAbout do
begin
// show name and version
if (ProductName <> '') {and (ProductVersion <> '')} then
begin
Caption := 'About ' + ProductName + ' ' + Productversion;
end;
ShowModal;
Free;
end;
end;
procedure TfrmAbout.btnOKClick(Sender: TObject);
begin
Close;
end;
procedure TfrmAbout.FormShow(Sender: TObject);
begin
inherited;
{ Get OS Version Information / moved to }
lblOSVersion.Caption := OSVerInfo();
{ Get the version information for IBConsole }
lblIBConsoleVer.Caption := IBConsoleVerInfo();
end;
procedure TfrmAbout.GetFileVersion(const Filename: String; out Major1,
Major2, Minor1, Minor2: integer);
{ Helper function to get the actual file version information }
{$IFDEF MSWINDOWS}
var
Info: Pointer;
InfoSize: DWORD;
FileInfo: PVSFixedFileInfo;
FileInfoSize: DWORD;
Tmp: DWORD;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
// Get the size of the FileVersionInformatioin
InfoSize := GetFileVersionInfoSize(PChar(FileName), Tmp);
// If InfoSize = 0, then the file may not exist, or
// it may not have file version information in it.
if InfoSize = 0 then
raise Exception.Create('Can''t get file version information for '
+ FileName);
// Allocate memory for the file version information
GetMem(Info, InfoSize);
try
// Get the information
GetFileVersionInfo(PChar(FileName), 0, InfoSize, Info);
// Query the information for the version
VerQueryValue(Info, '\', Pointer(FileInfo), FileInfoSize);
// Now fill in the version information
Major1 := FileInfo.dwFileVersionMS shr 16;
Major2 := FileInfo.dwFileVersionMS and $FFFF;
Minor1 := FileInfo.dwFileVersionLS shr 16;
Minor2 := FileInfo.dwFileVersionLS and $FFFF;
finally
FreeMem(Info, FileInfoSize);
end;
{$ENDIF}
end;
procedure TfrmAbout.HTTPLinkClick(Sender: TObject);
begin
{$IFDEF MSWINDOWS}
inherited;
ShellExecute(0, 'open', PChar((Sender as TLabel).Caption), '', '', SW_SHOWNORMAL);
{$ENDIF}
end;
end.