DWORD dwVersion = GetVersion();
// Get the Windows version.
DWORD dwWindowsMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion)));
DWORD dwWindowsMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion)));
// Get the build number.
if (dwVersion < 0x80000000) // Windows NT/2000/XP
return WIN_NT_2000_XP;
else if (dwWindowsMajorVersion < 4) // Win32s
return WIN_32S;
else // Windows 95/98/Me
return WIN_95_98_ME;