DelphiFAQ Home Search:

Retrieving the active version of Windows or DOS

 

commentsThis 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:

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Los Angeles, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.