-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathSelfVersion.pas
More file actions
43 lines (34 loc) · 844 Bytes
/
SelfVersion.pas
File metadata and controls
43 lines (34 loc) · 844 Bytes
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
{
DelphiProtocolBuffer: SelfVersion.pas
Copyright 2014 Stijn Sanders
Made available under terms described in file "LICENSE"
https://github.com/stijnsanders/DelphiProtocolBuffer
}
unit SelfVersion;
interface
function GetSelfVersion: string;
implementation
uses SysUtils, Windows;
function GetSelfVersion: string;
var
r:THandle;
p:pointer;
v:PVSFIXEDFILEINFO;
vl:cardinal;
begin
try
r:=LoadResource(HInstance,
FindResource(HInstance,MakeIntResource(1),RT_VERSION));
p:=LockResource(r);
if VerQueryValue(p,'\',pointer(v),vl) then
Result:=Format('v%d.%d.%d.%d',
[v.dwFileVersionMS shr 16
,v.dwFileVersionMS and $FFFF
,v.dwFileVersionLS shr 16
,v.dwFileVersionLS and $FFFF
]);
except
Result:='v???';
end;
end;
end.