Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

knowing what kind of windows used

Posted on 2002-03-08
11
Medium Priority
?
201 Views
Last Modified: 2010-04-05
how can i identify if what kind of operating system am i using?

that will identify which kind of O.S.
Windows95,windows98,windows2000,windowsNT,windowsXP,
windows ME,windows98 SE
etc. all kinds of Microsoft operating system software...
0
Comment
Question by:ryan_sabarre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +3
11 Comments
 

Author Comment

by:ryan_sabarre
ID: 6849888
help me please
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6849901
There are several components/units out there which solve the problem.
Have a look at http://delphi-jedi.org/CODELIBJCL for example.
The Jedi Code Librarycontains the function you need.

(and please be more patient. after 15 minutes not many experts have read your question).
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 6850231
listening
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 6850265
Use the Windows API GetSystemInfo for this.
<Quote>
The GetSystemInfo function returns information about the current system.

VOID GetSystemInfo(
    LPSYSTEM_INFO lpSystemInfo      // address of system information structure  
   );

Parameters:
* lpSystemInfo - Points to a SYSTEM_INFO structure to be filled in by this function.
Return Values: This function does not return a value.

See Also SYSTEM_INFO
</Quote>

Which just means in Delphi:
var SystemInfo: TSystemInfo;
begin
  GetSystemInfo(SystemInfo);
  // Do something with the SystemInfo variable.
end;

The SystemInfo variable in this case will identify the type of processor. Now you also want the Windows version. That's an easy one too. Use the Windows API GetVersionEx function:
<Quote>
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
   );    

Parameters:
* lpVersionInformation - Pointer to an OSVERSIONINFO data structure that the function fills with operating system version information. Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of the OSVERSIONINFO data structure to sizeof(OSVERSIONINFO).

Return Values:
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError. The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO structure.

Remarks:
The GetVersionEx function supersedes the GetVersion function and is the preferred method for obtaining operating system version number information. New applications should use the GetVersionEx function rather than the GetVersion function.

See Also OSVERSIONINFO
</Quote>

This you use as follows:
var VersionInfo: TOSVersionInfo;
begin
  VersionInfo.dwOSVersionInfoSize := SizeOf(TOSVersionInfo);
  if GetVersionEx(VersionInfo) then begin
    // Examine version info.
  end;
end;

This structure should provide you all the information you need about the OS.
0
 

Author Comment

by:ryan_sabarre
ID: 6855186
Can i have a complete code for this problem?
0
 
LVL 6

Accepted Solution

by:
Stuart_Johnson earned 150 total points
ID: 6855479
function GetSystemType: Integer;
const
  { operating system constants }
  cOsUnknown = -1;
  cOsWin95 = 0;
  cOsWin98 = 1;
  cOsWin98SE = 2;
  cOsWinME = 3;
  cOsWinNT = 4;
  cOsWin2000 = 5;
  cOsWinXP = 6;

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 := cOsWinXP
            else
            result := cOsUnknown;
          end; {case }
      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 {if Version = 'A'}
              else
                if (majorVer = 4) AND (minorVer = 90) then
                  result := cOsWinME
                else
                   result := cOsUnknown;
        end; {case VER_PLATFORM_WIN32_WINDOWS}
      else
       result := cOsUnknown;
    end;
  end
else
   result := cOsUnknown;
end;



procedure TForm1.Button1Click(Sender: TObject);
const
  OSTypes: Array[-1..6] of String = ('Unknown','Windows 95','Windows 98',
    'Windows 98 SE','Windows ME','Windows NT 4.0','Windows 2000','Windows XP');

begin
  Showmessage('You are running '+OSTypes[GetSystemType]);
end;
0
 

Expert Comment

by:nclong
ID: 6875961
Pls. try the code below :-

function GetWinVersion: String;
var
VerInfo: TOSVersionInfo;
ResultStr: string;
begin
ResultStr := '';
VerInfo.dwOSVersionInfoSize := SizeOf(VerInfo);
GetVersionEx(VerInfo);
with VerInfo do
 begin
   case dwPlatformID of
     VER_PLATFORM_WIN32S: ResultStr := ResultStr + 'Windows 3.1x running Win32s ';
     VER_PLATFORM_WIN32_WINDOWS:
       begin
         if IntToStr(dwMajorVersion) + '.' + IntToStr(dwMinorVersion) < '4.10' then
           ResultStr := ResultStr + 'Windows 95 ' + szCSDVersion + ' '
         else
           ResultStr := ResultStr + 'Windows 98 ' + szCSDVersion + ' ';
       end;
     VER_PLATFORM_WIN32_NT:
       begin
         if dwMajorVersion = 5 then
           ResultStr := ResultStr + 'Windows 2000 '
         else
           ResultStr := ResultStr + 'Windows NT ';
       end;
   end;
   ResultStr := ResultStr + IntToStr(dwMajorVersion) + '.' + IntToStr(dwMinorVersion) + ' ';
   ResultStr := ResultStr + '(Build ' +  IntToStr(LoWord(dwBuildNumber)) + ') ';
   if dwPlatformID = VER_PLATFORM_WIN32_NT then
     ResultStr := ResultStr + szCSDVersion;
 end;
Result := ResultStr;
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(GetWinVersion);
end;
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 6876002
nclong,

You're not showing the different OS's as requested (95/98/ME/NT/2000/XP).

Stu.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 6876006
ryan_sabarre,

This question has been open for 10 days without any comment from you.  You were very quick to ask for help when none was supplied in 13 minutes, but now a working solution has been posted, you've become very quite.

Can you please provide some feed back to the people who have spent their time solving the problem for you, and either accept a comment as an answer, or request more details to further assist you in your problem.

I will lock this question with an answer in two days if I don't here from you (to prevent the autograder kicking in).

Thank-you,

Stuart.
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6876012
The Jedi Code Library is still out there. It even detects Windows ME when posing as Windows 98 to programs named Setup.exe
0
 

Author Comment

by:ryan_sabarre
ID: 6887990
sorry and im very sorry if ever i did not grade anyone of you there!!, and its been long also i havent hold my computer, coz it was infected with win.cih and fun-love virus. the problem i have is already solved. i found a component that can identify if what kind of OS is running.
this will return the exact "words" or "letters" as spelled -[windows 98]-[windows XP] etc.

your answer Stuart Johnson is Good it also detect the kind of OS in my computer. im very thankfull.

Sorry all of you if i did not responds right away.

sorry.
Ryan.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question