Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to determine the OS

how to implement a function that will return the OS name? detect the environment where the program running on?

win2000/xp/vista/win7 etc...?

like image 565
XBasic3000 Avatar asked Aug 10 '10 09:08

XBasic3000


1 Answers

Since Delphi XE2 you can use TOSVersion record. Note, that it is a global record and you cannot create TOSVersion variables.

For example:

lblVersion.Caption := TOSVersion.ToString;

You have few record properties available to use: Minor, Major, Build, Architecture provided together with Platform which you can use to make sure that the operating system is Windows.

To compare the current version of the system with defined one, use Check version.

like image 50
Jacek Krawczyk Avatar answered Oct 30 '22 22:10

Jacek Krawczyk