Windows with Delphi Windows API (94) Windows Filesystem (41) Windows Forms (69) Windows Graphics (38)
Exchange Links About this site Links to us 
New related comments Number of comments in the last 48 hoursPlay WAV files 1 new comments
|
Retrieving the active version of Windows or DOS
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Call the GetVersion Windows API function to return version information for Windows and DOS.
The function returns a LongInt which contains this information:
- Byte #1 - Windows Version (Integer part)
- Byte #2 - Windows Version (Fractional part)
- Byte #3 - DOS Version (Fractional part)
- Byte #4 - DOS Version (Integer part)
To display the versions in a Delphi form, create two Labels and add the following OnCreate event-handler:
 | |  | | procedure TForm1.FormCreate(Sender: TObject);
var
Version : LongInt;
begin
Version := GetVersion;
Label1.Caption := 'Windows ' +
IntToStr(LoByte(LoWord(Version))) + '.' +
IntToStr(HiByte(LoWord(Version)));
Label2.Caption := 'DOS ' +
IntToStr(HiByte(HiWord(Version))) + '.' +
IntToStr(LoByte(HiWord(Version)));
end; | |  | |  | You don't like the formatting? Check out SourceCoder then!
Comments:
|