?
Solved

How to get info on OS?

Posted on 1999-01-21
3
Medium Priority
?
154 Views
Last Modified: 2012-05-04
I want to know the Windows version (95, 98, NT) running on my PC on startup of my Delphi 3.0 application. Is there a command to retrieve this subsystem information? Can you give me the full code of a working function? Thanks.
0
Comment
Question by:Zoroaster
  • 2
3 Comments
 
LVL 20

Accepted Solution

by:
Madshi earned 160 total points
ID: 1362673
Use this function:

uses Windows;

type TOperatingSystem = (osUnknown, osWin311, osWin95, osWin95osr2, osWin98, osWinNT3, osWinNT4, osWinNT5);
var OS      : TOperatingSystem;
    OSReady : boolean = false;
function GetOperatingSystem : TOperatingSystem;
var os1 : TOSVersionInfo;
begin
  if not OSReady then begin
    OSReady:=true;
    os1.dwOSVersionInfoSize:=sizeOf(os1); GetVersionEx(os1);
    case os1.dwPlatformID of
      VER_PLATFORM_WIN32s        : OS:=osWin311;
      VER_PLATFORM_WIN32_WINDOWS : if (os1.dwMajorVersion=4) and (os1.dwMinorVersion=0) then begin
                                     if os1.dwBuildNumber>1000 then OS:=osWin95osr2 else OS:=osWin95;
                                   end else if (os1.dwMajorVersion=4) and (os1.dwMinorVersion=10) then
                                     OS:=osWin98
                                   else OS:=osUnknown;
      VER_PLATFORM_WIN32_NT      : case os1.dwMajorVersion of
                                     0..3 : OS:=osWinNT3;
                                     4    : OS:=osWinNT4;
                                     5    : OS:=osWinNT5;
                                   end;
      else                         OS:=osUnknown;
    end;
  end;
  result:=OS;
end;

Regards, Madshi.
0
 

Author Comment

by:Zoroaster
ID: 1362674
This is more than I expected. Always nice when somebody answers a question in a serious way. Thanks a lot!
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1362675
Glad to help you...  :-)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

864 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