forked from Faq/Truice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
About.pas
127 lines (113 loc) · 3.34 KB
/
About.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
{*******************************************************}
{ }
{ "About", version 2.0 }
{ }
{ Copyright (c) 2006-2008 "Indomit Soft" }
{ }
{ Original code is About.pas }
{ Created: Komin Mikhail }
{ Last updated: 29.01.2006 }
{ Modifed: Komin Mikhail }
{ }
{*******************************************************}
{ }
{ Äàííûé ìîäóëü ñîäåðæèò ôîðìó "Î ïðîãðàììå..." }
{ }
{*******************************************************}
{
var
F: TAboutBox;
begin
F:=TAboutBox.MyCreate(Self);
try
F.ShowModal;
finally
F.Free;
end;
end;
}
unit About;
interface
uses Windows, SysUtils, Forms, Classes, Graphics, Dialogs, Math,
Controls, StdCtrls, ExtCtrls, ActnList, ExtActns, Registry, JvExControls, JvPoweredBy;
type
TAboutBox = class(TForm)
ActionList1: TActionList;
BrowseURL1: TBrowseURL;
Panel2: TPanel;
Bevel1: TBevel;
OKButton: TButton;
Panel1: TPanel;
lblVersion: TLabel;
lblAutorName: TLabel;
LinkSite: TLabel;
Image1: TImage;
BrowseURL2: TBrowseURL;
lbdbversion: TLabel;
JvPoweredByJVCL1: TJvPoweredByJVCL;
lbprojectwebsite: TLabel;
Label2: TLabel;
Label1: TLabel;
procedure FormShow(Sender: TObject);
procedure LinkSiteClick(Sender: TObject);
private
procedure InitializeCaptions;
{ Private declarations }
public
dbversion: string;
constructor MyCreate (AOwner: TComponent);
{ Public declarations }
end;
implementation
uses StrUtils, Functions, MyDataModule;
{$R *.dfm}
function GetFileVersion(FileName: string; var Major, Minor, Release, Build: Word): Boolean;
var
Size, Size2: DWORD;
Pt, Pt2: Pointer;
begin
Result:= False;
(*** Get version information size in exe ***)
Size:= GetFileVersionInfoSize(PChar(FileName),Size2);
(*** Make sure that version information are included in exe file ***)
if Size > 0 then
begin
GetMem(Pt, Size);
GetFileVersionInfo(PChar(FileName), 0, Size, Pt);
VerQueryValue(Pt, '\', Pt2, Size2);
with TVSFixedFileInfo(Pt2^) do
begin
Major:= HiWord(dwFileVersionMS);
Minor:= LoWord(dwFileVersionMS);
Release:= HiWord(dwFileVersionLS);
Build:= LoWord(dwFileVersionLS);
end;
FreeMem(Pt, Size);
Result:= True;
end;
end;
procedure TAboutBox.InitializeCaptions;
var
Major, Minor, Release, Build: Word;
begin
// îïðåäåëåíèå âåðñèè
if GetFileVersion(Application.ExeName, Major, Minor, Release, Build) then
lblVersion.Caption:= Format('Version %d.%d.%d.%d',[Major, Minor, Release, Build])
else
lblVersion.Caption:='';
end;
procedure TAboutBox.FormShow(Sender: TObject);
begin
InitializeCaptions;
lbdbversion.Caption := dbversion;
end;
procedure TAboutBox.LinkSiteClick(Sender: TObject);
begin
BrowseURL1.URL:='http://github.com/Faq/Truice';
BrowseURL1.Execute;
end;
constructor TAboutBox.MyCreate(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
end.