Solved

Current OS

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

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

912 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

16 Experts available now in Live!

Get 1:1 Help Now