Distinguish between Win9x and NT

Hi,
Are there any ways to distinguish the OS between Windows 9x and Windows NT?  (Ways not involving the registry preferred.)
(D2)
yingkitAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hubdogCommented:
The GetVersionEx function obtains extended information about the version of the operating system that is currently running.

BOOL GetVersionEx(

    LPOSVERSIONINFO lpVersionInformation       // pointer to version information structure
   );      
 
0
hubdogCommented:
{$IFDEF WIN32}
function GetVersionEx(lpOs : pointer) : BOOL; stdcall;
 external 'kernel32' name 'GetVersionExA';
{$ENDIF}

procedure GetWindowsVersion(var Major : integer;
                            var Minor : integer);
var
 {$IFDEF WIN32}
  lpOS, lpOS2 : POsVersionInfo;
 {$ELSE}
  l : longint;
 {$ENDIF}
begin
 {$IFDEF WIN32}
   GetMem(lpOS, SizeOf(TOsVersionInfo));
   lpOs^.dwOSVersionInfoSize := SizeOf(TOsVersionInfo);
   while getVersionEx(lpOS) = false do begin
     GetMem(lpos2, lpos^.dwOSVersionInfoSize + 1);
     lpOs2^.dwOSVersionInfoSize := lpOs^.dwOSVersionInfoSize + 1;
     FreeMem(lpOs, lpOs^.dwOSVersionInfoSize);
     lpOS := lpOs2;
   end;
   Major := lpOs^.dwMajorVersion;
   Minor := lpOs^.dwMinorVersion;
   FreeMem(lpOs, lpOs^.dwOSVersionInfoSize);
 {$ELSE}
  l := GetVersion;
  Major := LoByte(LoWord(l));
  Minor := HiByte(LoWord(l));
 {$ENDIF}
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  Major : integer;
  Minor : integer;
begin
  GetWindowsVersion(Major, Minor);
  Memo1.Lines.Add(IntToStr(Major));
  Memo1.Lines.Add(IntToStr(Minor));
end;
0
yingkitAuthor Commented:
I tried it on a NT machine, however, the program said that kernel32 cound not be found in the specified path........some paths here.
When it was run in a Win95 machine, memo1 only gave two numbers, 4 and 0
What will be the numbers if the program is run under NT?
0
MadshiCommented:
uses SysUtils;

  if Win32Platform = VER_PLATFORM_WIN32_WINDOWS then
    ShowMessage('win9x');
  if Win32Platform = VER_PLATFORM_WIN32_NT then
    ShowMessage('winNT');

Regards, Madshi.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.