Solved

Current OS

Posted on 2001-07-23
3
162 Views
Last Modified: 2010-04-06
Hi there,

How do I know the current Operating System where my application is running?

This is during runtime.

Thanks,
Gladys
0
Comment
Question by:gladz
3 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6307675
0
 
LVL 4

Accepted Solution

by:
YodaMage earned 100 total points
ID: 6308836
function TUtility.GetOSInfo: String;
var
   Platform: String;
   BuildNumber: Integer;
begin
   case Win32Platform of
     VER_PLATFORM_WIN32_WINDOWS:
       begin
         Platform := 'Windows 95';
         BuildNumber := Win32BuildNumber and $0000FFFF;
       end;
     VER_PLATFORM_WIN32_NT:
       begin
         Platform := 'Windows NT';
         BuildNumber := Win32BuildNumber;
       end;
       else
       begin
         Platform := 'Windows';
         BuildNumber := 0;
       end;
   end;
   if (Win32Platform = VER_PLATFORM_WIN32_WINDOWS) or
     (Win32Platform = VER_PLATFORM_WIN32_NT) then
   begin
     if Win32CSDVersion = '' then
       Result := Format('%s %d.%d (Build %d)', [Platform, Win32MajorVersion,
         Win32MinorVersion, BuildNumber])
     else
       Result := Format('%s %d.%d (Build %d: %s)', [Platform, Win32MajorVersion,
         Win32MinorVersion, BuildNumber, Win32CSDVersion]);
   end
   else
     Result := Format('%s %d.%d', [Platform, Win32MajorVersion,
       Win32MinorVersion])
end;
0
 

Expert Comment

by:Skorup
ID: 6311412
Do it in this way.

var
  OS:TOsVersionInfo;
begin
  OS.dwOSVersionInfoSize:=SizeOf(os);
  GetVersionEx(os);
  case os.dwPlatformId of
   VER_PLATFORM_WIN32s: Form1.Caption:='WIN 3.1';
   VER_PLATFORM_WIN32_WINDOWS: Form1.Caption:='WIN 95\98';
   VER_PLATFORM_WIN32_NT: Form1.Caption:='WIN NT';
  end;
end;


 
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Intraweb submit form as a POST request 4 321
Printing problem 2 101
CheckListBox usage 3 71
RESTRequest Parameter 4 41
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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…

792 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