Enrico,
for some reason the class TReg32() doesn't work for me
This code is ok:
#define HKEY_LOCAL_MACHINE 2147483650
#define REG_SZ 0
#define REG_DWORD 4
#define KEY_ALL_ACCESS 983103
FUNCTION My_Get_Reg32( cKey, cSubkey, uVar)
//
// Get a key from the registry
//
LOCAL hKey := 0
LOCAL nType
LOCAL cData := SPACE( 256 )
LOCAL nSize := LEN( cData )
LOCAL nData
//
Default cKey := "SYSTEM\CurrentControlSet\Control\TimeZoneInformation"
Default cSubkey := "ActiveTimeBias"
Default uVar := 0
//
IF Valtype( uVar ) == "N"
nType := REG_DWORD
ELSE
nType := REG_SZ
ENDIF
REGOPENKEY( HKEY_LOCAL_MACHINE, cKey, 0, KEY_ALL_ACCESS, @hKey )
REGQUERYVALUE( hKey, cSubkey, 0, @nType, @cData, @nSize)
REGCLOSEKEY( hKey )
IF Valtype( uVar ) == "N"
nData := BIN2L( cData )
cData := Str( nData )
ENDIF
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, cDataName 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"
It returns -120 ( GMT + 1 hour + daylight saving = 2 hours)!
Thanks to you and Rao