Solved

Get Operating System

Posted on 2000-04-02
2
164 Views
Last Modified: 2010-04-04
How do I get the Operating system I need code that works for every thing form Windows 95 to Windows NT 5 ;] Thanks
0
Comment
Question by:nafa2221
2 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 100 total points
ID: 2678090
here a couple of functions ..

procedure TForm1.Button1Click(Sender: TObject);
var
OS : TOSVersionInfo;
begin
OS.dwOSVersionInfoSize := sizeof(OS);
GetVersionEx(OS);
with OS do
    case dwPlatformId of
        VER_PLATFORM_WIN32s :
              label1.caption := 'Windows 3.1x/32s';
        VER_PLATFORM_WIN32_WINDOWS :
            Begin
                if (dwMajorVersion = 4) and (dwMinorVersion > 0) then begin
               label1.caption := 'Windows 98';
               label2.caption := inttostr(dwMajorVersion);
               label3.caption := inttostr(dwMinorVersion);
               label4.caption := inttostr(dwPlatformID);
               label5.caption := inttostr(loword(dwBuildNumber));
               label6.caption := os.szCSDVersion;
                end
              else
                label1.caption := 'Windows 95';
            end;
        VER_PLATFORM_WIN32_NT :

          label1.caption := 'Windows NT' ;
      end;
  end;






another:

This function is the same as GetWindowsVersion() above but returns a detailed string version of the OS.

function GetWindowsVersionStr: 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: ResultStr := ResultStr + 'Windows NT ';
      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;

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2678092
Use the Win32Platform variable.

VER_PLATFORM_WIN32s      System is Win32s.
VER_PLATFORM_WIN32_WINDOWS      System is Windows 95.
VER_PLATFORM_WIN32_NT      System is Windows NT.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

11 Experts available now in Live!

Get 1:1 Help Now