GetCurrentVersion/de
Deutsch · English
Zurück zur Seite Code Beispiele.
Dieser Artikel beschäftigt sich mit der Windowsprogrammierung.
Die Funktion ermittelt die aktuelle Version des eigenen Programms.
uses
Windows, SysUtils, ...;
...
function funGetCurrentVersion: string;
var
lwdVerInfoSize: longword;
lwdVerValueSize: longword;
lwdDummy: longword;
ptrVerInfo: Pointer;
VersionsInformationen: PVSFixedFileInfo;
begin
lwdVerInfoSize := GetFileVersionInfoSize(PChar(ParamStr(0)), lwdDummy);
GetMem(ptrVerInfo, lwdVerInfoSize);
GetFileVersionInfo(PChar(ParamStr(0)), 0, lwdVerInfoSize, ptrVerInfo);
VerQueryValue(ptrVerInfo, '\', Pointer(VersionsInformationen), lwdVerValueSize);
with VersionsInformationen^ do
begin
Result := IntToStr(dwFileVersionMS shr 16);
Result := Result + '.' + IntToStr(dwFileVersionMS and $FFFF);
Result := Result + '.' + IntToStr(dwFileVersionLS shr 16);
Result := Result + '.' + IntToStr(dwFileVersionLS and $FFFF);
end;
FreeMem(ptrVerInfo, lwdVerInfoSize);
end;
...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.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
