Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Registry.vcx 1

Status
Not open for further replies.

CCorax

Programmer
Feb 6, 2002
10
US
I am attempting to use the registry.vcx foundation class to create and access licensing and registration information for my application. However, I can't make sense of the syntax for its functions. In MSDN's help, it shows the syntax for one of the functions like:

IsKey(cKeyName, nRegKey)

OK, cKeyName is obvious, but I don't know what nRegKey, which is described as "the Registry key ID" means. How do I find out / specify a numerical ID for a registry key or value?

Also, many of these functions return Win Api error codes. Is there any easy way to get the text for these functions?

Thanks!
Ben
 
Hi

#DEFINE HKEY_LOCAL_MACHINE -2147483646 &&
#DEFINE TAREGKEYSTR4 "MyKey\myexe"

if !this.IsKey(TAREGKEYSTR4,HKEY_LOCAL_MACHINE)

Hope this helps

AjoyK
 
ajoyk,

Thanks! but...

#DEFINE HKEY_LOCAL_MACHINE -2147483646 &&

... what is the significance of the number -2147483646 ?

C
 
Ben,
It's what MS decided was the internal value for this section of the registry. While it makes more "sense" if you convert it to hex, it's easier just to use the defined constants and not worry about the actual value.
Note:
#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

Rick

 
Great. And how about these:

cOptName - the name of the Registry key option.
What's a registry key option?

cKeyPath - the path to the Registry key.
Just a Registry key path in this format?
"HKEY_LOCAL_MACHINE\Software\Windows\Help"

nUserKey - the User key
What's a User Key? Is this something created when I make a new key, like a file id with fcreate()?

 
Hi

To call this function
*LPARAMETER cOptName,cOptVal,cKeyPath,nUserKey

#DEFINE DBCNAMEKEY 'DbcName'
#DEFINE TAREGKEYSTR4 'Software\MySoftTech'

GetRegKey(DBCPATHKEY,@cValue,TAREGKEYSTR4,HKEY_LOCAL_MACHINE)

cOptName is a name of a key
@cValue is the string value of the key
ckeyPath is the path to the key
nUserKey is the branch in which the key is.

There is registry.vcx class. Drop it on a form and call these functions. The above function if successful will return 0.

Hope this helps.

AjoyK
 
Hi

To call this function
*LPARAMETER cOptName,cOptVal,cKeyPath,nUserKey

#DEFINE DBCNAMEKEY 'DbcName'
#DEFINE TAREGKEYSTR4 'Software\MySoftTech'

GetRegKey(DBCPATHKEY,@cValue,TAREGKEYSTR4,HKEY_LOCAL_MACHINE)

cOptName is a name of a key
@cValue is the string value of the key
ckeyPath is the path to the key
nUserKey is the branch in which the key is.

There is registry.vcx class. Drop it on a form and call these functions.

Hope this helps.

AjoyK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top