GetCurrentVersion: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | - | ||
| 2 | - | ||
| 3 | - | ||
| 4 | - | ||
| 5 | - | ||
| 6 | - | ||
| 7 | - | ||
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 11 | - | ||
| 12 | - | ||
| 13 | - | ||
| 14 | - | ||
| 15 | - | ||
| 16 | - | ||
| 17 | - | ||
| 18 | - | ||
| 19 | - | ||
| 1 | + | [](</File:Windows_logo_-_2012.svg>) | |
| 20 | 2 | ||
| 21 | - | ||
| 3 | + | This article applies to [Windows](</Category:Windows> "Category:Windows") only. | |
| 22 | 4 | ||
| 23 | - | ||
| 24 | - | ||
| 25 | - | ||
| 26 | - | ||
| 5 | + | See also: [[Multiplatform Programming Guide]] | |
| 27 | 6 | ||
| 28 | - | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 34 | - | ||
| 7 | + | │ **[[GetCurrentVersion/de|Deutsch (de)]]** │ **English (en)** │ | |
| 8 | + | **** | |
| 35 | 9 | ||
| 36 | - | ||
| 10 | + | Return to the [[Code Examples|Code Examples page]]. | |
| 37 | 11 | ||
| 38 | - | ||
| 12 | + | This article deals with Windows programming. | |
| 39 | 13 | ||
| 40 | - | ||
| 14 | + | The function determines the current version of your own program. | |
| 41 | 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 | + | ... | |
| 49 | + | ``` | |
| 42 | 50 | ||
| 43 | 51 | --- | |
| 44 | - | ||
| 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).* |
