[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Current OS

Posted on 2001-07-23
3
Medium Priority
?
167 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
YodaMage earned 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

656 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