Last active
August 29, 2015 13:57
-
-
Save anaisbetts/9420720 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static bool IsWindows81OrHigher() | |
{ | |
var notepad = Environment.ExpandEnvironmentVariables("%SystemRoot%\\Notepad.exe"); | |
var realOsVersion = FileVersionInfo.GetVersionInfo(notepad); | |
return (new Version(realOsVersion.ProductVersion) >= new Version(6, 3, 0, 0)); | |
} |
I'm laughing with you, not at you.
👍
lolz. Very creative. And will work great until it is run on a machine where someone has swapped notepad.exe with a notepad replacement (despite the fact that there is a registry key that can be used to avoid replacing the actual binary).
Consider using "feature detection" instead of Windows version checks (e.g. use LoadLibrary and GetProcAddress to see if the library and function is available before using). See anaisbetts/PerMonitorDpi#1 for details.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ha ha ha!