turk_bayr.jpg (8863 bytes)

header.jpg (23201 bytes)

PROG
RAM

22 Haz 2001 FIND WINDOWS VERSION and SERVICE PACK NUMBER

VC++ Articels


button_programming.jpg (4736 bytes)







(works in: Microsoft Window/3.1(Win32s)/95/98/ME/NT/2000)

It is sometimes useful to determine the system type, version number, and/or service pack number of a Windows system from within a program. The Windows API provides the functions GetVersion and GetVersionEx for this purpose, but they are often cumbersome to use.

The function GET_WIN_VERSION gets the relevant information in one easy call, and the values are returned as integers.

The routine is available as part of the C++ source file EXAM39.CPP. The routine has the following calling parameters:

        int GET_WIN_VERSION(int *,int *,int *,int *)

where all values are returned by the routine. The function value is 0 for success, and non-zero for an error condition.

The four integer arguments are interpreted as follows:

       1st   :    System Type (0=unknown, 1=Win 3.x, 2=Win/95, 4=Win/ME

                              5=Win/NT, 6=Win/2000)

       2nd   :    Major Version Number (e.g. 3 for Win/NT v3.51)

       3rd   :    Minor Version Number (e.g. 51 for Win/NT v3.51)

       4th   :    Service Pack Number (Win/NT/2000 only)

You can download the file in ZIP format by clicking on the following link.

Download Exam39.zip (2 kB, last modified: 1/12/2001)

This works for Microsoft Windows 3.x/95/98/ME/NT/2000. I have tested with Visual C++ v6.0 but it should work with other versions also. Please let me know of exceptions.

After downloading, unzip the file Exam39.cpp into any folder. It contains a short console mode program which demonstrates how to call GET_WIN_VERSION.

 

 

home | about me | links | projects | clean energy | programming

 

 

 

 

 

 

Hosted by www.Geocities.ws

1