GetVersion

 

Description

Retrieve current version number of the operating system.

Syntax

UINT GetVersion( )

Parameters

Return

the version number. The low byte of the low word is the major OS version, the high byte

of the low word is the minor OS version. The highest bit determines the platform: it is

on for Windows 95, 98, and Me, it is off for Windows NT, 2000, XP.

Examples

EX1

// This example checks if the operating system is of "NT-type"
// (which means Windows NT, 2000, XP).
int GetVersion_ex1()
{
    DWORD    dwVersion = GetVersion();
    // Get major and minor version numbers of Windows
    WORD loword = LOWORD(dwVersion);
    int lowbyte = LOBYTE(loword);
    int hibyte =  HIBYTE(loword);
        
    printf("Window major version = %d and minor version = %d\n", lowbyte, hibyte);
    
    if(!(dwVersion & 0x80000000))                // Windows NT, 2000, XP
        return 1;
    else         // Windows 95, 98, ME
        return 0;
}

Remark

See Also

Header to Include

origin.h

Reference