Solved

Current OS

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

809 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