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

Detecting Windows98

I know how to detect Windows95 and WindowsNT but
how can I detect windows 98 is running.
The code I use is below.

Thanks Vincent
---------------------------------------
Var
OSVersionInfo : TOSVersionInfo;
Uitslag : String;

begin
  Uitslag := '';
  OSVersionInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
  GetVersionEx(OSVersionInfo);

  case OSVersionInfo.dwPlatformID of
    VER_PLATFORM_WIN32_WINDOWS : Uitslag := 'Windows95';
    VER_PLATFORM_WIN32_NT : Uitslag := 'WindowsNT';
  end;
0
Vincentg
Asked:
Vincentg
  • 2
1 Solution
 
heathprovostCommented:
The easiest thing to do is to use the minor build number contained in the OSVersionInfo structure as follows:

...
  VER_PLATFORM_WIN32_NT: Uitslag := 'WindowsNT';
end;
if (OSVersionInfo.dwMinorVersion = 10) and
   (Utslag = 'Windows95') then Utslag := 'Windows98';

ps.  This could be written much cleaner but you should get the idea.  Basically if the dwMinorVersion is 10 then you are on Win98.

Hope this helps
0
 
heathprovostCommented:
I typoed the answer above - it should be 1.0 or 1, not 10 for the minorVersion
0
 
danyszCommented:
here is a complete answer

   osVerInfo.dwOSVersionInfoSize := SizeOf( OSVERSIONINFO);
   GetVersionEx( osVerInfo);

   case osVerInfo.dwPlatformId of
      VER_PLATFORM_WIN32s:
         begin
            OSPlatform.Caption := STR_OS + Chr( 9) + 'Win32s';
         end;
      VER_PLATFORM_WIN32_WINDOWS:
         begin
            osVerInfo.dwBuildNumber := osVerInfo.dwBuildNumber and $0000FFFF;
            if (osVerInfo.dwMajorVersion > 4) or ((osVerInfo.dwMajorVersion = 4) and
               (osVerInfo.dwMinorVersion >= 10)) then
            begin
               mnuOSPlatform.Caption := STR_OS + Chr( 9) + 'Windows 98';
            end
            else
            begin
               mnuOSPlatform.Caption := STR_OS + Chr( 9) + 'Windows 95';
            end;
         end;
      VER_PLATFORM_WIN32_NT:
      begin
         mnuOSPlatform.Caption := STR_OS + Chr( 9) + 'Windows NT';
      end;
   end; {case}

0
 
YoniCommented:
You can also use the get version function. You can find an example on how to use it in the win32.hlp file on the delphi cd.
There's also source there on how to get the build numbers but it's in c++
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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