How can we detect windows 10 version without mistake ?
Which method is uded
will cWinVersion() return 10 ?
if we use TINFO := OS_VERSIONINFO()
TINFO[1] = 6 .AND. TINFO[2] = 4 // windows 10 ? version 6.4 ?
thanks fo reply
Richard
How can we detect windows 10 version without mistake ?
Which method is uded
will cWinVersion() return 10 ?
if we use TINFO := OS_VERSIONINFO()
TINFO[1] = 6 .AND. TINFO[2] = 4 // windows 10 ? version 6.4 ?
thanks fo reply
Richard
OSVERSIONINFO vi;
vi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
GetVersionEx( &vi );
hb_reta( 5 );
#ifdef __XPP__
#define hb_storc( x, y, z ) STORC( x, params, y, z )
#define hb_stornl( x, y, z ) STORNL( x, params, y, z )
#endif
hb_storvnl( (long) vi.dwMajorVersion, -1, 1 );
hb_storvnl( (long) vi.dwMinorVersion, -1, 2 );
hb_storvnl( (long) vi.dwBuildNumber, -1, 3 );
hb_storvnl( (long) vi.dwPlatformId, -1, 4 );
hb_storvc( (char*) vi.szCSDVersion, -1, 5 );Applications not manifested for Windows 8.1 or Windows 10 Insider Preview will return the Windows 8 OS version value (6.2). Once an application is manifested for a given operating system version, GetVersionEx will always return the version that the application is manifested for in future releases
HKLM\software\microsoft\Windows NT\CurrentVersion
#define HKEY_LOCAL_MACHINE 2147483650 // 0x80000002
function IsWindows10()
local oReg := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Microsoft\Windows NT",;
.f. )
local cCurrentVersion := oReg:Get( "CurrentVersion" )
oReg:Close()
// MsgInfo( cCurrentVersion )
return cCurrentVersion == "6.3"function cWinVersion()
local aVersion := GetVersion()
local cVersion := ""
do case
case aVersion[ 4 ] == VER_PLATFORM_WIN32_NT
if aVersion[ 1 ] == 6
if aVersion[ 2 ] == 0
cVersion = "Vista"
elseif aVersion[ 2 ] == 1
cVersion = "7"
elseif aVersion[ 2 ] == 2
if IsWindows10()
cVersion = "10"
else
cVersion = "8"
endif
endif
endif
...#define HKEY_LOCAL_MACHINE 2147483650 // 0x80000002
function IsWindows10()
local oReg := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Microsoft\Windows NT\CurrentVersion",;
.f. )
local cCurrentVersion := oReg:Get( "CurrentVersion" )
oReg:Close()
// MsgInfo( cCurrentVersion )
return cCurrentVersion == "6.3"Antonio
Thanks for your work,
6.3 is the windows version code for windows 8
Are you running a real windows 10 version ?
From what i read at MSDN
BOOL WINAPI IsWindows10OrGreater(void);
…
if (!IsWindows10OrGreater())
{
MessageBox(NULL, "You need at least Windows 10.", "Version Not Supported", MB_OK);
}
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx
Tim can you test on your windows 10 version ?
the test is
TINFO := OS_VERSIONINFO()
msginfo("TINFO[1] " + cvaltochar(TINFO[1]) + CRLF + "TINFO[2] " + cvaltochar(TINFO[2])) // i think it will return 6 and 4
Thanks for help
Richard,
I am running Windows 10 build 10130
The screenshots I posted were taken with Windows 10 running natively
below is a copy of my registry in windows 8.1
http://www.logicielspro/rcc/temp/windows8.png
#define HKEY_LOCAL_MACHINE 2147483650 // 0x80000002
function IsWindows10()
local oReg := TReg32():New( HKEY_LOCAL_MACHINE,;
"SOFTWARE\Microsoft\Windows NT\CurrentVersion",;
.f. )
local cProductName := oReg:Get( "ProductName" )
oReg:Close()
return "Windows 10" $ cProductName