Sign in Join
Wiki copytemporary

GetCurrentVersion/de: what changed

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

Title: GetCurrentVersion/de

OldNewLine
1+Zurück zur Seite [[code examples/de|Code Beispiele]].
2+
3+Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.
4+
5+Die Funktion ermittelt die aktuelle Version des eigenen Programms.
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+ VersionsInformationen: PVSFixedFileInfo;
20+
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(VersionsInformationen), lwdVerValueSize);
27+
28+ with VersionsInformationen^ 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+...
41+```
42+
43+---
44+*From the Free Pascal wiki, page "GetCurrentVersion/de", 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