Sign in Join
Wiki copytemporary

GetCurrentVersion: what changed

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

OldNewLine
1-Return to the [[Code Examples|Code Examples page]].
2-
3-This article deals with Windows programming.
4-
5-The function determines the current version of your own program.
6-
7-``` pascal
8- uses
9- Windows, SysUtils, ...;
10-
11- ...
12-
13- function funGetCurrentVersion: string;
14- var
15- lwdVerInfoSize: longword;
16- lwdVerValueSize: longword;
17- lwdDummy: longword;
18- ptrVerInfo: pointer;
19- VersionsInformation: PVSFixedFileInfo;
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>)
202
21- begin
3+This article applies to [Windows](</Category:Windows> "Category:Windows") only.
224
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);
5+See also: [[Multiplatform Programming Guide]]
276
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;
7+│ **[[GetCurrentVersion/de|Deutsch (de)]]** │ **English (en)** │
8+****
359
36- FreeMem(ptrVerInfo, lwdVerInfoSize);
10+Return to the [[Code Examples|Code Examples page]].
3711
38- end;
12+This article deals with Windows programming.
3913
40- ...
14+The function determines the current version of your own program.
4115```
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+ ...
49+```
4250
4351---
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).*
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).*

Back to history