Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need an example for the GetRegKey() in registry.vcx
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00572563
Message ID:
00572606
Views:
51
>I have been trying to get the registry functions to work to no avail.
>
>I admit to being a bit dense sometimes, but after carefully reading throug the functions and the sample code it's still all greek to me.
>
>The following is part of the code for the GetKeyValue() function:
>
>
>LPARAMETER cValueName,cKeyValue
>
>LOCAL lpdwReserved,lpdwType,lpbData,lpcbData,nErrCode
>STORE 0 TO lpdwReserved,lpdwType
>STORE SPACE(256) TO lpbData
>STORE LEN(m.lpbData) TO m.lpcbData
>
>DO CASE
>CASE TYPE("THIS.nCurrentKey")#'N' OR THIS.nCurrentKey = 0
>	RETURN ERROR_BADKEY
>
>And that's as far as it ever gets.
>
>The nCurrentKey is initially 0 and I dont see it being set anywhere, and it's not part of the parameters, so how does this work and what's the value supposed to be?
>
>We used to have lots of (not always very good) code samples in VFP Help butn it seems like a lot of that went down the drain with VFP7.
>
>Anyway,
>
Peter,

You need to first open the key using the OpenKey() method. If you do not specify a key it defaults to HKEY_CLASSES_ROOT. Here's an example:
lckey = "Excel.Application\CurVer"
SET CLASSLIB TO REGISTRY.VCX ADDITIVE
oReg = CREATEOBJECT("Registry")
RELEASE CLASSLIB REGISTRY
IF oReg.OpenKey(lckey) = 0 && No error
  lcvalue = ""
  IF oReg.GetKeyValue("", @lcvalue) = 0 && No error
    ? lcvalue
  ENDIF
  oReg.CloseKey()
ENDIF
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform