Solved

Current OS

Posted on 2001-07-23
3
159 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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 I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

15 Experts available now in Live!

Get 1:1 Help Now