• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 383
  • Last Modified:

GetVersionEx ->win95/Win98 ?

using GetVersionEx I retrieve VER_PLATFORM_WIN32_WINDOWS for Win95 just as for Win98.
Is there a way to find out which one is the current OS besides checking the dwMinorVersion for 0 or 1 ?

Thanx for your help!
Regards, Oli
0
Oli2
Asked:
Oli2
  • 7
  • 6
1 Solution
 
intheCommented:
well i find this quite eay way:

procedure TForm1.Button1Click(Sender: TObject);
var
OS : TOSVersionInfo;
begin
OS.dwOSVersionInfoSize := sizeof(OS);
GetVersionEx(OS);
with OS do
    case dwPlatformId of
        VER_PLATFORM_WIN32s :
              label1.caption := 'Windows 3.1x/32s';
        VER_PLATFORM_WIN32_WINDOWS :
            Begin
                if (dwMajorVersion = 4) and (dwMinorVersion > 0) then
                label1.caption := 'Windows 98'
              else
                label1.caption := 'Windows 95';
            end;
        VER_PLATFORM_WIN32_NT :
            label1.caption := 'Windows NT' ;
      end;
  end;


Regards Barry
0
 
Oli2Author Commented:
Hi, Barry!
That's about what I thought of already.
Is there defenetly no Version of Win95 with a dwMinorVersion > 0 ?? And: Do you know what Win2000 will give me as a result?
Seems I'll have to stick with checking dwMinorVersion, huh?

Regards, Oli
0
 
Oli2Author Commented:
Oh something else...
how to check whether it is Win98 or Win98 SE ??

Regards, Oli
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
Oli2Author Commented:
let me put this some other way:
do you know of a list with

dwMajorVersion
dwMinorVersion
dwBuildNumber

for each OS (Win95A, Win95B, Win98, Win98SE, etc etc. )

Regards, Oli
0
 
intheCommented:
you could also read the verion stuff from the registry:

HKEY_LOCAL_MACHINE
Software\Microsoft\Windows\CurrentVersion

example:

 //uses registry;

procedure TForm1.Button2Click(Sender: TObject);
var
r : tregistry;
s,S2,s3 : string;

begin
 R := TRegistry.Create;
 with R do  try
  Begin
 Rootkey:=HKEY_LOCAL_MACHINE;
  CreateKey('\Software\Microsoft\Windows\CurrentVersion');
   OpenKey('\Software\Microsoft\Windows\CurrentVersion', True);
    s := ReadString('Version');
    S2 := ReadString('VersionNumber');
    S3 := ReadString('ProductName');
 R.CloseKey;
  end;
   finally
  R.Free;
   end;
   label1.caption := s;
   label2.Caption := s2;
   label3.Caption := s3;
   end;

0
 
intheCommented:
oh i see your comments ,
i have a look around :-)
0
 
Oli2Author Commented:
thanx, barry
WinNT might have the information in
\Software\Microsoft\Windows NT\CurrentVersion
instead of
\Software\Microsoft\Windows\CurrentVersion

don't know about that - screwed my NT-machine last week :-(

anyway, I don't really like reading stuff from the registry,
since it really slows things down sometimes.

if you could find a list that'd be great.

Regards, Oli
0
 
intheCommented:
near bottom of page :
http://vb.ora.com/news/versions_0899.html

for Windows 2000, the major version number is 5 , the minor version number is 0.

Windows NT version 3.51, the major version number is 3; and for Windows NT version 4.0, the major version number is 4.

for Windows NT version 3.51, the minor version number is 51; and for Windows NT version 4.0, the minor version number is 0.

might be some in this code that ive missed:
http://msdn.microsoft.com/library/psdk/sysmgmt/sysinfo_92jy.htm

sorry couldnt find just 1 listing that covered all ,.
0
 
Oli2Author Commented:
thanx for your help barry.
the links look interesting.
I'll read my way through.

post them as an answer to receive the points.

By the way: in Win2000 the major number is 5, you're right, but  the dwPlatformID is VER_PLATFORM_WIN32_NT....!
Just in case anybody will read this later and wonder.

:-)

Regards, Oli
0
 
intheCommented:
another imcomplete list(i think we have these anyway)
http://support.microsoft.com/support/kb/articles/Q189/2/49.ASP

and i think i missed this one:

win98SE dwmajorversion is 4
dwminorversion is 10
0
 
intheCommented:
ok ,
again sorry there doesnt seem one easy list to read .. typical huh :-)
regards Barry

btw.
i know you dont want registry but there is also another key that can read :

same path as before and key is SubVersionNumber (on my 98SE it reads an "A" )

see ya


0
 
intheCommented:
label6.caption := os.szCSDVersion;
would give the A for win98SE

NT5 major version is 5 also as win2k
couldnt find a minor version for it anywhere.presume its same a win2k now they are the same os (so to speak)..
0
 
Oli2Author Commented:
thanx again barry!
I might put up a list myself sometime.

Regards, Oli
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now