How to get operating system version information (part 1 of 6)
- Common Windows API OS Information
- Delphi RTL Support
- OS Version Information Class
- Extended Windows API OS Information
- Extending Delphi's RTL Support
- OS Version Information Class: Version 2
- Getting Information About NT 4 from the Registry
- OS Version Information Class: Version 3
- More XP Related OS Information
- OS Version Information Class: Version 4
- Demo code
There are times when you need to know information about the version of Windows your program is running on. For example:
- when reporting bugs;
- when wishing to take different actions on different operating systems.
The Windows API provides some version information that is common to all 32 bit Windows operating systems. Delphi's run time library (RTL) makes access to this information very straightforward. We will begin our exploration by seeing how to get the information from the Windows API. Next we will look at Delphi's RTL support and begin the development of a static class that uses this information to provide easy access to OS information.
Having reviewed the basic information we will then examine additional information provided by the operating system on later Windows NT OSs. We will use this information to enhance Delphi's RTL support for NT and to extend our static class.
Since the additional information we get from Windows is only available on later NT OSs, we will see how to get similar information for early NT OSs by accessing the registry. We will enhance our static class to be able to utilise the the information from the registry.
The last enhancement of our static class will be made when we look at how to detect further information about Windows XP. In particular we will find out how to detect Windows Media Center and Tablet editions and how to learn if a program is running on 64 bit Windows.
Our exploration begins in the next section where we discuss the basic information about the OS that is available on all Windows systems.
This article is copyright © Peter Johnson 2005-2006
Licensed under a Creative Commons License.