Possible Duplicate:
How to detect true Windows version
I have an application which uses a third-party library(dll – no source code) which protect (encrypt) some customer data, this dll must be initializated using different params depending of the current Windows Version. If my app is executed in XP compatibility mode under Windows 7, the dll encrypt method fails. So i need a way to detect when My App is running under compatibility mode to prevent this issue. So How I can detect if my application is running under compatibility mode?
You can compare the value returned by the
GetVersionExfunction against the Version property of theWin32_OperatingSystemWMI class.Try this sample