How to check which Windows Version is running in Visual Studio C++ project?

visual-studio
windows

(afree) #1

I am trying to make a windows Version Checker (program) using C++ in VisualStudio 2013. I tried GetVersion() Method but it’s not very user friendly, Can you suggest something?

thanks.


(Yassine) #2

this link should be helpful: Version Helper functions, all you need to do is include the file versionhelpers.h it’s part of the Windows Software development Kit (SDK) starting from Windows 8.1.

it has the following methods that can be very helpful to you:

  • IsWindowsXPOrGreater
    Returns TRUE if the current running OS is Windows XP version or newer, otherwise FALSE.

  • IsWindowsXPSP1OrGreater
    Returns TRUE if the current running OS is Windows XP with Service Pack 1 (SP1) version or newer, otherwise FALSE.

  • IsWindowsXPSP2OrGreater
    Returns TRUE if the current running OS is Windows XP with Service Pack 2 (SP2) version or newer, otherwise FALSE.

  • IsWindowsXPSP3OrGreater
    Returns TRUE if the current running OS is Windows XP with Service Pack 3 (SP3) version or newer, otherwise FALSE.

  • IsWindowsVistaOrGreater
    Returns TRUE if the current running OS is Windows Vista version or newer, otherwise FALSE.

  • IsWindowsVistaSP1OrGreater
    Returns TRUE if the current running OS is Windows Vista with Service Pack 1 (SP1) version or newer, otherwise FALSE.

  • IsWindowsVistaSP2OrGreater
    Returns TRUE if the current running OS is Windows Vista with Service Pack 2 (SP2) version or newer, otherwise FALSE.

  • IsWindows7OrGreater
    Returns TRUE if the current running OS is Windows 7 version or newer, otherwise FALSE.

  • IsWindows7SP1OrGreater
    Returns TRUE if the current running OS is Windows 7 with Service Pack 1 (SP1) version or newer, otherwise FALSE.

  • IsWindows8OrGreater
    Returns TRUE if the current running OS is Windows 8 version or newer, otherwise FALSE.

  • IsWindows8Point1OrGreater
    Returns TRUE if the current running OS is Windows 8.1 version or newer, otherwise FALSE.

  • IsWindows10OrGreater
    Returns TRUE if the current running OS is Windows 10 version or newer, otherwise FALSE.

  • IsWindowsServer
    This function can be used to check whether running on Server Version or Client Version of Windows, It returns TRUE if the current running OS is a Server OS, otherwise FALSE.

  • IsWindowsVersionOrGreater
    This is a good function to be used, that indicates whether the currently running OS has a version that matches or newer than the one provided to the function.