How to verify Windows 7 operating system using VerifyVersionInfo

Following code snipper show you can use VerifyVersionInfo API to check if user is running Windows 7 or not. Key is to remember that Major Version of Windows 7 is 6 and minor version is 1.


int _tmain(int argc, _TCHAR* argv[])
{
OSVERSIONINFOEX ver;
DWORDLONG condMask = 0;
ZeroMemory(&ver, sizeof(OSVERSIONINFOEX));
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
ver.dwMajorVersion = 6;
ver.dwMinorVersion = 1;
VER_SET_CONDITION(condMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(condMask, VER_MINORVERSION, VER_GREATER_EQUAL);
BOOL bRet =
VerifyVersionInfo(&ver, VER_MAJORVERSION | VER_MINORVERSION, condMask);
return 0;
}

Views: 1015

Related

Windows 7 Operating System VersionHow to detect operating system version of Windows 7 using GetVersion or GetVersionEx APIUnable to activate windows after upgrading Windows XPHow to fix problem of Windows activation after upgrading operation system? Unable to activate copy o...Installing Windows 7 64bit From Windows XP 32 bitHow to install Windows 7 64 bit on Windows XP machine?How to use Bing Maps In Windows 7 PhoneHow to use Bing Maps Silverlight Control In Windows 7 PhoneWindows Version NumbersWhat are version numbers for different windows operating systems?

Powered by BlogEngine.NET 1.5.1.7
Theme by Naveen Kohli