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"
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
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: MaxP and 51 guests