VersionHelpers.pas

VersionHelpers.pas

As you might know, Microsoft changed the GetVersion(Ex) API function in Windows 8.1 and Server 2012 R2: Both GetVersion() and GetVersionEx() are now deprecated, and will always return V6.2 (Windows 8.0) unless you extend your application manifest for targeting Windows 8.1.

More details here: http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074(v=vs.85).aspx 

The recommended way to test for a specific Windows version is to use VerifyVersionInfo() from Windows API. But Microsoft added some new functions in Windows 8.1 SDK for easier test for a specific windows version like "Windows 7 or higher". Those new functions are located in VersionHelpers.h and are named "IsWindowsXPOrGreater", "IsWindowsVistaOrGreater" or "IsWindowsVersionOrGreater()". The latter takes Major, Minor and SP as parameters.

I've translated that VersionHelpers.h to Delphi: 
https://dl.dropboxusercontent.com/u/56217889/VersionHelpers.pas
http://msdn.microsoft.com/en-us/library/windows/desktop/dn302074(v=vs.85).aspx

Comments

  1. Something to add to the QC, Marco Cantù ?
    Slightly related to http://qc.embarcadero.com/wc/qcmain.aspx?d=119244 - but that one has already been commited, it seems.

    ReplyDelete

Post a Comment