XBMC USB Controller solderpad
xbmc-usb-controller / Controller / fmAbout.pas
//******************************************************************************
// XBMC USB Controller for Windows.
// Copyright � 2011 Dilshan R Jayakody.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//******************************************************************************
unit fmAbout;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, JvExControls, JvLinkLabel, Shellapi;
type
TfrmAbout = class(TForm)
Label1: TLabel;
Label2: TLabel;
lblVersion: TLabel;
Label3: TLabel;
btnOK: TButton;
lblLink: TJvLinkLabel;
Memo1: TMemo;
function GetVersion(): string;
procedure lblLinkClick(Sender: TObject);
procedure btnOKClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmAbout: TfrmAbout;
implementation
{$R *.dfm}
procedure TfrmAbout.lblLinkClick(Sender: TObject);
begin
ShellExecute(0,'open','http://www.jayakody.info','','',1);
end;
function TfrmAbout.GetVersion(): string;
var
VerInfoSize: DWORD;
VerInfo: Pointer;
VerValueSize: DWORD;
VerValue: PVSFixedFileInfo;
Dummy: DWORD;
begin
VerInfoSize := GetFileVersionInfoSize(PChar(ParamStr(0)), Dummy);
GetMem(VerInfo, VerInfoSize);
GetFileVersionInfo(PChar(ParamStr(0)), 0, VerInfoSize, VerInfo);
VerQueryValue(VerInfo, '\', Pointer(VerValue), VerValueSize);
with VerValue^ do
begin
Result := IntToStr(dwFileVersionMS shr 16);
Result := Result + '.' + IntToStr(dwFileVersionMS and $FFFF);
Result := Result + '.' + IntToStr(dwFileVersionLS shr 16);
Result := Result + '.' + IntToStr(dwFileVersionLS and $FFFF);
end;
FreeMem(VerInfo, VerInfoSize);
end;
procedure TfrmAbout.btnOKClick(Sender: TObject);
begin
Close;
end;
procedure TfrmAbout.FormCreate(Sender: TObject);
begin
self.lblVersion.Caption := GetVersion;
end;
end.