We help IT Professionals succeed at work.

How can I tell if I'm running on Win ME?

jexd99
jexd99 asked
on
Medium Priority
165 Views
Last Modified: 2010-04-06

Is there a way to know whether you are on Win ME or not?

          Thank you
Comment
Watch Question

Commented:
Hi, use the GetOperatingSystem to determine the
Windows version:

If GetOperatingSystem = 3 then
  ShowMessage('Windows ME');
else
  ShowMessage('Not Windows ME');
 


const
  { operating system (OS)constants }
  cOsUnknown  = -1;
  cOsWin95    =  0;
  cOsWin98    =  1;
  cOsWin98SE  =  2;
  cOsWinME    =  3;
  cOsWinNT    =  4;
  cOsWin2000  =  5;
  cOsWhistler =  6;


function GetOperatingSystem : integer;
var
  osVerInfo    : TOSVersionInfo;
  majorVer, minorVer : Integer;
begin
  result := cOsUnknown;
  { set operating system type flag }
  osVerInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
  if GetVersionEx(osVerInfo) then
  begin
   majorVer := osVerInfo.dwMajorVersion;
   minorVer := osVerInfo.dwMinorVersion;
    case osVerInfo.dwPlatformId of
      VER_PLATFORM_WIN32_NT : { Windows NT/2000 }
        begin
          if majorVer <= 4 then
            result := cOsWinNT
          else if (majorVer = 5) AND (minorVer= 0) then
            result := cOsWin2000
          else if (majorVer = 5) AND (minorVer = 1) then
            result := cOsWhistler
          else
            result := cOsUnknown;
        end;
      VER_PLATFORM_WIN32_WINDOWS :  { Windows 9x/ME }
        begin
          if (majorVer = 4) AND (minorVer = 0) then
            result := cOsWin95
          else if (majorVer = 4) AND (minorVer = 10) then
          begin
            if osVerInfo.szCSDVersion[1] = 'A' then
              result := cOsWin98SE
            else
              result := cOsWin98;
          end
          else if (majorVer = 4) AND (minorVer = 90) then
            result := cOsWinME
          else
            result := cOsUnknown;
        end;
    else
      result := cOsUnknown;
    end;
  end
  else
    result := cOsUnknown;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowMessage(IntToStr(GetOperatingSystem));
end;

Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
I don't know why that's happened :(
last try
if you want to check win me only, here's a sample for that, but if you want to detect the OS, look at the Tasomia comment

procedure TForm1.Button1Click(Sender: TObject);
var
 VersionInfo : TOSVersionInfo;
begin
 VersionInfo.dwOSVersionInfoSize := SizeOf( TOSVersionInfo );
 if Windows.GetVersionEx( VersionInfo ) then
    begin
       with VersionInfo do
       begin
          if (dwPlatformId = VER_PLATFORM_WIN32_WINDOWS) and (dwMajorVersion = 4) and (dwMinorVersion = 90) then
            ShowMessage('Windows Me Installed');
       end;
    end
end;
Have a look at the Jedi Code Library also. http://delphi-jedi.org/CODELIBJCL
Windows ME has a nasty trick. If your program is named Setup.exe it lies about the version. ME poses as Windows 98  then.

Commented:
:-)

Or look at my free package madBasic, it also contains a function to ask the operating system, which doesn't get confused by setup.exe.

http://help.madshi.net/Data/OSInfo.htm

Regards, Madshi.

Author

Commented:
Thanks a bunch.  

Explore More ContentExplore courses, solutions, and other research materials related to this topic.