Sign in Join
Wiki copytemporary

GetCurrentVersion: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
1-[![Windows logo - 2012.svg](https://upload.wikimedia.org/wikipedia/commons/thumb/5/5f/Windows_logo_-_2012.svg/50px-Windows_logo_-_2012.svg.png)](</File:Windows_logo_-_2012.svg>)
1+Return to the [[Code Examples|Code Examples page]].
22
3-This article applies to [Windows](</Category:Windows> "Category:Windows") only.
3+This article deals with Windows programming.
44
5-See also: [[Multiplatform Programming Guide]]
5+The function determines the current version of your own program.
66
7-│ **[[GetCurrentVersion/de|Deutsch (de)]]** │ **English (en)** │
8-****
7+``` pascal
8+ uses
9+ Windows, SysUtils, ...;
910
10-Return to the [[Code Examples|Code Examples page]].
11+ ...
1112
12-This article deals with Windows programming.
13+ function funGetCurrentVersion: string;
14+ var
15+ lwdVerInfoSize: longword;
16+ lwdVerValueSize: longword;
17+ lwdDummy: longword;
18+ ptrVerInfo: pointer;
19+ VersionsInformation: PVSFixedFileInfo;
1320
14-The function determines the current version of your own program.
15-```
16-uses
17- Windows, SysUtils, ...;
18-
19- ...
20-
21- function funGetCurrentVersion: string;
22- var
23- lwdVerInfoSize: longword;
24- lwdVerValueSize: longword;
25- lwdDummy: longword;
26- ptrVerInfo: pointer;
27- VersionsInformation: PVSFixedFileInfo;
28-
29- begin
30-
31- lwdVerInfoSize: = GetFileVersionInfoSize(PChar(ParamStr(0)), lwdDummy);
32- GetMem(ptrVerInfo, lwdVerInfoSize);
33- GetFileVersionInfo(PChar(ParamStr(0)), 0, lwdVerInfoSize, ptrVerInfo);
34- VerQueryValue (ptrVerInfo, '\', Pointer(VersionsInformation), lwdVerValueSize);
35-
36- with VersionsInformation^ do
37- begin
38- Result: = IntToStr (dwFileVersionMS shr 16);
39- Result: = Result + '.' + IntToStr(dwFileVersionMS and $ FFFF);
40- Result: = Result + '.' + IntToStr(dwFileVersionLS shr 16);
41- Result: = Result + '.' + IntToStr(dwFileVersionLS and $ FFFF);
42- end;
43-
44- FreeMem(ptrVerInfo, lwdVerInfoSize);
45-
46- end;
47-
48- ...
21+ begin
22+
23+ lwdVerInfoSize: = GetFileVersionInfoSize(PChar(ParamStr(0)), lwdDummy);
24+ GetMem(ptrVerInfo, lwdVerInfoSize);
25+ GetFileVersionInfo(PChar(ParamStr(0)), 0, lwdVerInfoSize, ptrVerInfo);
26+ VerQueryValue (ptrVerInfo, '\', Pointer(VersionsInformation), lwdVerValueSize);
27+
28+ with VersionsInformation^ do
29+ begin
30+ Result: = IntToStr (dwFileVersionMS shr 16);
31+ Result: = Result + '.' + IntToStr(dwFileVersionMS and $ FFFF);
32+ Result: = Result + '.' + IntToStr(dwFileVersionLS shr 16);
33+ Result: = Result + '.' + IntToStr(dwFileVersionLS and $ FFFF);
34+ end;
35+
36+ FreeMem(ptrVerInfo, lwdVerInfoSize);
37+
38+ end;
39+
40+ ...
4941```
5042
5143---
52-*From the Free Pascal wiki, page "GetCurrentVersion", as the Internet Archive kept it on 2024-09-14. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
44+*From the Free Pascal wiki, page "GetCurrentVersion", as it stood on 2020-02-16 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history