0

I am working on a C++ application. I want to check the version of the OS on which my C++ application is running to take some action. Basically, all I want to check if the OS version is Windows 2019 or not so that I can take some action. I see that we can use the VersionHelpers.h as below

   if (IsWindows8OrGreater())
    {
        printf("Windows8OrGreater\n");
    }

    if (IsWindows8Point1OrGreater())
    {
        printf("Windows8Point1OrGreater\n");
    }

    if (IsWindows10OrGreater())
    {
        printf("Windows10OrGreater\n");
    }

    if (IsWindowsServer())
    {
        printf("Server\n");
    }

However, I want to write only one if block to see if the version is windows 2019. Is there any way to do so?

user496934
  • 3,822
  • 10
  • 45
  • 64

1 Answers1

0

I think you can use VersifyVersionInfo to implement your own methods. https://learn.microsoft.com/en-us/windows/desktop/api/Winbase/nf-winbase-verifyversioninfoa

Using this method you can know if it is not a specific version.