Solved

How to get info on OS?

Posted on 1999-01-21
3
148 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 40 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 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