Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP Registry Class IsKey Method
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00474655
Message ID:
00474821
Views:
21
>I’m trying to check a value in a Registry key using the VFP Registry Foundation Class which is on a form.
>
>The value is under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
>
>Using the syntax
>llKeyIs = THISFORM.registry1.IsKey(lcKeyPath,'HKEY_LOCAL_MACHINE')
>
>If I have lcKeyPath = 'SOFTWARE\Microsoft\Windows\CurrentVersion'
>
>I get .t. as a response but if I have lcKeyPath = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall' I get .f. as the response even though that key is there.
>
>Is there a string length restriction or can anybody tell me why I can’t get a .t. for the Uninstall key when I can get it for the CurrentVersion key?
>
>TIA
>
Ed,

If you're using the syntax exactly as shown, you're not accessing the hive you think you are. Actually, you're checking HKEY_CLASSES_ROOT, not HKEY_LOCAL_MACHINE. The IsKey function passes your parameters on to OpenKey to attempt to open the registry key. Early in this function, it checks to see if the variable type is numeric, if it isn't, it tries to open the key specified under HKEY_CLASSES_ROOT. Since your example is passing a string this would be what happens. Try the following:
#DEFINE HKEY_CLASSES_ROOT           -2147483648  && BITSET(0,31)
#DEFINE HKEY_CURRENT_USER           -2147483647  && BITSET(0,31)+1
#DEFINE HKEY_LOCAL_MACHINE          -2147483646  && BITSET(0,31)+2
#DEFINE HKEY_USERS                  -2147483645  && BITSET(0,31)+3
llKeyIs = THISFORM.registry1.IsKey(lcKeyPath, HKEY_LOCAL_MACHINE)
George

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

Click here to load this message in the networking platform