Why does Windows 7 returns version number 6.1 using DosVersion? lazarus / 61-Beginners ---------------------------------------------------------------------- bulrush · 2016-06-02 12:24 I'm on Windows 7 Pro but DosVersion returns version 6.1. Why is that? Code: [Select]procedure TForm1.Button1Click(Sender: TObject); //uses dos; var Version : word;   OS:string[32]; begin   OS:=''; {$IFDEF LINUX}   OS:='Linux'; {$ENDIF} {$ifdef FreeBSD}   OS:='FreeBSD'; {$endif} {$ifdef NetBSD}   OS:='NetBSD'; {$endif} {$ifdef Solaris}   OS:='Solaris'; {$endif} {$ifdef QNX}   OS:='QNX'; {$endif} {$IFDEF DOS}   OS:='Dos'; {$ENDIF} {$IFDEF WINDOWS}   OS:='Windows'; {$ENDIF}   Memo1.lines.clear;   Memo1.Lines.Add('App.params[0]:'+Application.Params[0] );   Memo1.lines.add('App.Exename:'+Application.Exename);   //Memo1.lines.add('GetConfigDir:'+GetAppConfigDir(false));   Version:=DosVersion;   Memo1.Lines.add('Current '+OS+' version is '+IntToStr(Lo(Version))+     '.'+IntToStr(Hi(Version))); end; Should I be using another version function to get the windows version? ---------------------------------------------------------------------- RAW · 2016-06-02 12:29 That's correct... Ask Microsoft... why they did that... :-) ---------------------------------------------------------------------- Thaddy · 2016-06-02 12:38 It is probably because MS used the base senary system and 7 could not be written in a singularity in that, so they had to device the decimal like point for it. See http://mathforum.org/library/drmath/view/60405.html for senary;) ---------------------------------------------------------------------- balazsszekely · 2016-06-02 12:40 https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions ---------------------------------------------------------------------- marcov · 2016-06-02 12:43 6+1 = 7 Seriously, it is normal. Windows versions and names are only weakly correlated. ---------------------------------------------------------------------- RAW · 2016-06-02 12:55 QuoteIt is probably because MS used the base senary system.. And I thought they did it to keep all the programmers relaxed... not to worry about a complete new Windows-Version, that needs to be tested with all their fine software... ---------------------------------------------------------------------- Thaddy · 2016-06-02 13:59 @SoE: Relax, if MS was using base binary we would be stuck at windows 10 from 1987 https://en.wikipedia.org/wiki/File:Windows_2.0.png ---------------------------------------------------------------------- Handoko · 2016-06-02 15:35 Quote from: bulrush on June 02, 2016, 02:24:34 pmShould I be using another version function to get the windows version? Try my code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.Button1Click(Sender: TObject);var  OS, Version, Release: string;begin   OS:='non-Windows';{$IFDEF WINDOWS}  OS:='Windows';{$ENDIF}   Release := IntToStr(Lo(DosVersion))+ '.'+IntToStr(Hi(DosVersion));  Version := '(unknown)';  if Release = '1.1'  then Version := '1.01';  if Release = '1.2'  then Version := '1.02';  if Release = '1.3'  then Version := '1.03';  if Release = '1.4'  then Version := '1.04';  if Release = '2.3'  then Version := '2.03';  if Release = '2.10' then Version := '2.10';  if Release = '2.11' then Version := '2.11';  if Release = '3.0'  then Version := '3.0';  if Release = '3.10' then Version := '3.1 or Windows NT 3.1';  if Release = '3.11' then Version := 'for Workgroups 3.11';  if Release = '3.2'  then Version := '3.2';  if Release = '3.50' then Version := 'NT 3.5';  if Release = '3.51' then Version := 'NT 3.51';  if Release = '4.0'  then Version := '95 or Windows NT 4.0';  if Release = '4.10' then Version := '98';  if Release = '5.0'  then Version := '2000';  if Release = '4.90' then Version := 'ME';  if Release = '5.1'  then Version := 'XP';  if Release = '5.2'  then Version := 'XP Professional x64';  if Release = '6.0'  then Version := 'Vista';  if Release = '6.1'  then Version := '7';  if Release = '6.2'  then Version := '8';  if Release = '6.3'  then Version := '8.1';  if Release = '10.0' then Version := '10';   ShowMessage('Your OS is '+OS+' '+Version); end; Information from: https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions Note: the code hasn't tested, it may or may not work correctly. ---------------------------------------------------------------------- Thaddy · 2016-06-02 15:56 Huh? I get OSX or a crash? Windows 1 is missing as is the latest windows 10.1. (No, not delphi berlin, windows 10.1) That kind of code is BAD, super BAD because it doesn't last long. Don't ever use it. For Handoko: Use always equal or bigger than... And even that is not a real option. ---------------------------------------------------------------------- Thaddy · 2016-06-02 17:01 Quote from: marcov on June 02, 2016, 02:43:46 pm6+1 = 7 Seriously, it is normal. Windows versions and names are only weakly correlated. I believe you studied it a bit , so no! In senary 6+1 equals 10. ---------------------------------------------------------------------- Handoko · 2016-06-02 17:09 Quote from: Thaddy on June 02, 2016, 05:56:56 pmUse always equal or bigger than... And even that is not a real option. Thanks for the advice. But the variable Release is a string type. Any explanation or pages that explain string comparison using '=>' is better? ---------------------------------------------------------------------- RAW · 2016-06-02 21:44 QuoteRelax, if MS was using base binary we would be stuck at windows 10 from 1987 If you ask me, that would be the better "Windows 10" and it looks so gorgeous... have never seen a picture of it, my first one was 3.1. A few weeks ago I saw someone on youtube installing 3.1 on Raspberry Pi... very funny... (DosBox). It felt like home... ---------------------------------------------------------------------- Thaddy · 2016-06-03 05:16 Mm. did not try win 3.1 but I have Windows 95 running on the RPi 1 model B under QEMU. Speed's not even that bad ---------------------------------------------------------------------- Thaddy · 2016-06-03 05:23 Quote from: Handoko on June 02, 2016, 07:09:24 pmQuote from: Thaddy on June 02, 2016, 05:56:56 pmUse always equal or bigger than... And even that is not a real option. Thanks for the advice. But the variable Release is a string type. Any explanation or pages that explain string comparison using '=>' is better? YOU are the one who translated the lot into strings. YOU think about why that is a stupid idea YOU know you wrote wrong code. Now YOU give us some proper code ? (I know, I did this many times myself, but don't be silly:bad idea's are bad idea's). And equal or greater than is written like this: >= Not to put too fine a point on it ---------------------------------------------------------------------- Handoko · 2016-06-03 05:30 Yeah I know it's not good to convert the integer to string. As I said, the code hasn't tested. I usually write first the things come out from my head. If it works correctly after testing, then I will optimize it. And yes, I typed too fast for the '>=' symbol.