Link to home
Start Free TrialLog in
Avatar of ryan_sabarre
ryan_sabarre

asked on

knowing what kind of windows used

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...
Avatar of ryan_sabarre
ryan_sabarre

ASKER

help me please
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).
listening
Avatar of Wim ten Brink
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.
Can i have a complete code for this problem?
ASKER CERTIFIED SOLUTION
Avatar of Stuart_Johnson
Stuart_Johnson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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;
nclong,

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

Stu.
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.
The Jedi Code Library is still out there. It even detects Windows ME when posing as Windows 98 to programs named Setup.exe
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.