Solved

How to get info on OS?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX StringGrid1->Canvas->FillRect Problem 3 127
find a node in VST 2 63
Moving (cutting/pasting) controls in a TTabbedNotebook... 7 27
Delphi and Access based Enumeration 9 47
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…
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 Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now