Does anyone know if TOSVersion.Name still works on Windows 10?
I have a vcl application that has a form show event that gets the operating system details and displays them in a TMemo box using TOSVersion record from SysUtils.
Windows Desktop Bridge. RAD Studio Windows Desktop Bridge Deployment Support allows developers to package win32 and win64 applications ready for the Windows 10 Store, directly from within the IDE! With Billions of applications globally written in Delphi and C++Builder, existing code is easily re-compiled and packaged.
The code executes without any issues on XP (Yes we're still using it (hangs head in shame)), Vista, Windows 7, Windows 8.1, Desktop PC's, laptops and Surface Pro's but not when installed on Windows 10.
When I debug using paserver, TOSVersion.Name comes back as := 'Windows 8'.Am I doing something wrong or am I expecting too much for TOSVersion to detect Windows 10? No exception is being triggered. Of the 2 x Windows 10 machines I have access to, one migration path was from Windows 8.1, the other one however was from Windows 7.
Many Thanks
Two things stop your code from returning the correct version:
GetVersionEx
, which TOSVersion
relies upon, will lie about the version.It so happens that XE8 update 1, I believe, changes the version detection to use NetWkstaGetInfo
which is not subject to this version lie. Although the call to NetWkstaGetInfo
does leak memory, but that's probably not important since it is only called once.
Some links relating to this subject:
If you absolutely must report the version to the user, then you have a variety of options:
supportedOS
option to your manifest and include the GUID for Windows 10. That stops GetVersionEx
from lying. Then use a modified version of TOSVersion
, or some other means, to obtain the version.NetServerGetInfo
.NetWkstaGetInfo
.RtlGetVersion
.More details in this question: How to detect true Windows version? Although note that the accepted answer there is out-of-date.
As an example of the WMI approach, you could use this code:
Have you tried using a custom manifest ?
I use XE8 and have no issues with TOSVersion recognizing Windows 10 when using a manifest file that targets Windows 8.1 and Windows 10.
My custom manifest is made to make my application 'Windows 10' aware.
Windows Receiver (beta). Are you eager to try the MirrorOp senders but do not have a receiver to use? Now you can easily turn your Windows PC into a. With MirroOp sender for Windows installed on your Windows computers in the home network, you can remotely operate the PCs from a receiver to watch videos,. The new wePresent MirrorOp software client for Windows and offers some. Full Video/Audio Mirroring from a Windows PC; Multi-touch on Windows 8 and 10. Supports PresentSense™ proximity detection; Supports multi-touch on Windows 8 and Windows 10; Show/hide functions based on the capabilities of connected. Mirrorop windows 10.
It is the following :
I got that from this link : https://msdn.microsoft.com/fr-fr/library/windows/desktop/dn481241(v=vs.85).aspx
And TOSVersion.Tostring on a Windows 10 1607 displays :