This...
versionInfo.dwOSVersionInfoSize := SizeOf(versionInfo);
GetVersionEx(versionInfo);
VMajor:= versionInfo.dwMajorVersion;
should return 6 for Windows 7 but it returns the same 5 as it does for XP.
Anyone know a reliable way to detect Windows 7 with VP?
Tags:
Views: 525
Hi !
Normally GetVersionEx should work but the version value may be different if the compatibility mode is activated.
Maybe you are running your program through VP and VP is set in XP-compatiblility mode under Win 7 ?
Regards
Thanks,
VP is running on a virtual machine, app is running on Win 7 and yes if compatibility mode is activated for the app then GetVersionEx will return that mode.
But is there a way of seeing past that to see if the OS is Win 7 even if a compatibility mode is being used?
Sorry should have worded the original question better.
Cheers,
Ken
Not via getversionex, but maybe you could try to read out the registry(though this is "NT" only I guess):
-------------------------------
You can read the OS version from the Registry key also
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
This key has a string called "CurrentVersion"
-------------------------------
You can also use the GetFileVersionInfo function on a system file such as kernel32.dll. There is an example at http://msdn.microsoft.com/en-us/library/windows/desktop/ms724429%28...
;)
© 2022 Created by Allan Mertner.
Powered by