José,
it seems, your example is not complete.
in the line
> IF :OpenKey( "SoftwareVema"
is somthing missing.
I put 2 edit boxes on the form, getting the key name from oEdit1 and the desired item name
from oEdit2.
I'm using the next code to test the TRregistry class:
---------------------------------------------
METHOD Button1Click( oSender ) CLASS TForm1
LOCAL oReg, cString,nError,aKeys
WITH OBJECT oReg := TRegistry():Create()
:Root := HKEY_LOCAL_MACHINE
IF nError := :OpenKey( ::oEdit1:Value) > 0
cString := :GetString( ::oEdit2:Value, "MyDefaultValue" )
aKeys := :EnumKeys()
MessageBox(Self,"Error code: " + TRANSFORM(:nLastError,"999") + CRLF +;
"Number of items:" + TRANSFORM(LEN(aKeys),"999"))
:CloseKey()
ELSE
MessageBox(Self,"Error opening Registry Key: " + TRANSFORM(nError,"999"))
ENDIF
END
::oLabel1:cText := cString
---------------------------------------------
My problem:
I tried many keys from my Registry, the result is always the same
- cString is "MyDefaultValue"
- LEN(aKeys) is zero
Any advise?
Gejza Horvath
"José Lalín" <
notelo@digo.com> pí¹e v diskusním pøíspìvku
news:46347afe$[email=
1@ozsrv2.ozlan.local...]
1@ozsrv2.ozlan.local...[/email]
>
> Gejza,
>
>> please help me, how to use the TRegistry class. The help file contains no information
>> about using this class.
>
> Check if your help file is updated since this component is documented from many time
> ago.
>
>> I need read the text value of VemaRoot property in the HKEY_LOCAL_MACHINESoftwareVema
>> key
>
> #include "WinReg.api"
>
> WITH OBJECT TRegistry():Create()
> :Root := HKEY_LOCAL_MACHINE
> IF :OpenKey( "SoftwareVema"
> cText := :GetString( "VemaRoot", "MyDefaultValue" )
> :CloseKey()
> ENDIF
> END
>
> Regards,
> José Lalín
>