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;
}