Page 1 of 1

GetVersion() problems

Posted: Wed Sep 19, 2007 11:52 am
by Romeo
Ciao,ancora io.
Ho un po di problemi con Vista....(mare)

La GetVersion() non mi funziona come dovrebbe con fw22/24 mentre funziona bene con harbour.

In pratica con w95,xp,vista fw22/24 mi dicono sempre:

getversion[1] = 3
getversion[2] = 95

Quindi non riesco a capire se sono con Vista,XP, o altro OS:

C'e' qualche rimedio ?
tks
Romeo/Zingoni

Posted: Thu Sep 27, 2007 3:26 pm
by Romeo
Ho risolto !

#INCLUDE "FiveWin.ch"

#define HKEY_LOCAL_MACHINE 2147483650
#define REG_SZ 0
#define KEY_ALL_ACCESS 983103


function main
local _ver_wind:=ver_wind()
local _l_isvista
if int(val(_ver_wind))=6
? "Sei su Vista"
else
? "Non Sei su Vista"
endif
return nil
*
function ver_wind()

LOCAL hKey := 0

LOCAL nType := REG_SZ

LOCAL cData := SPACE( 256 )

LOCAL nSize := LEN( cData )

REGOPENKEY( HKEY_LOCAL_MACHINE,"Software\Microsoft\Windows NT\CurrentVersion", 0, KEY_ALL_ACCESS, @hKey )

REGQUERYVALUE( hKey, "CurrentVersion", 0, @nType, @cData, @nSize)

REGCLOSEKEY( hKey )

cData = LEFT( cData, AT( CHR( 0 ), cData ) - 1 )

RETURN cData


DLL32 FUNCTION REGOPENKEY( hKey AS LONG, cSubKey AS LPSTR, nOptions AS DWORD, nSamDesired AS DWORD, @nHandle AS PTR ) AS LONG;
PASCAL FROM "RegOpenKeyExA" LIB "advapi32.dll"

DLL32 FUNCTION REGQUERYVALUE( hKey AS LONG, cValueName AS LPSTR, nReserved AS LONG, @nType AS PTR, @cData AS LPSTR, @nSize AS PTR ) AS LONG;
PASCAL FROM "RegQueryValueExA" LIB "advapi32.dll"

DLL32 FUNCTION REGCLOSEKEY( hKey AS LONG ) AS LONG;
PASCAL FROM "RegCloseKey" LIB "advapi32.dll"
*