Link to home
Start Free TrialLog in
Avatar of TimB
TimB

asked on

writing to HKEY_LOCAL_MACHINE??

Using RegCreateKeyEx it seems that I cannot create a regestry key under HKEY_USERS or HKEY_LOCAL_MACHINE.  Is there a way to get around this problem?
If possible I'd like to steer away from CWinApp class members too.. - is this possible?

Tim
Avatar of plaroche
plaroche

What kinds of problems are you having?

I write to HKEY_LOCAL_MACHINE\Software quite easily and it works fine.  Are you under NT? If so have you checked that the logged user is administrator of the machine? I think it's needed to write to that registry section.
ASKER CERTIFIED SOLUTION
Avatar of gunn
gunn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ahhhhhhhhh, stupid me ;)

I read it, thinking 'ahh! I have done that!, only to (after posting the "answer") find out after reading -again- the question, that you were looking for way to *create* the key....doh!  I have done that too, but don't have the code at my fingertips....

sorry about that, you can reject my answer ;(

-Tom

Avatar of TimB

ASKER

Thanks for the help,  I figured out how to create a key under HKLM, I think it was just me not being able to understand mocrosoft help files - doh!

Here's what I did in the end:

RegCreateKeyEx(HKEY_LOCAL_MACHINE,      // handle of an open key
                  StrKeyPath, //  address of subkey name
                  0, // address of class string
                  NULL, // special options flag
                  0, //
                  KEY_SET_VALUE,  
                  NULL,
                  &hKey,
                          NULL) == ERROR_SUCCESS)


Thanks for your help anyway, and here's 130 points,

Bye-ee ;)

Tim