-
Registry
I have been trying to create a key in the registry with my program. This is what I have tried:
Code:
RegCreateKeyEx(HKEY_LOCAL_MACHINE, REG_KEY, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, &Type)
Each time this is returning an error. I am not sure why this is happening.
Does anyone have any examples of opening, saving or getting information, and closing the registry so I could see how it is done. I tried this once on Windows 98, but it does not seem to be working on Windows 2000. I have been trying some of the code I found on MSDN, but it still is not working.
- Sean
-
Does the user have access to the reg? If not, i don't think it will work.
-
What error is it returning?
(I have registry code which works on 9x/NT4 but have never tried it with 2000).
-
Whenever you put REG_KEY I assume that is a #define?
Well, It needs to be pointing into soom sub-directory. Try this...
instead of REG_KEY...replace with
TEXT("Software\\My Application\\Settings");
I tryed your code on my machine with that change and it worked fine. Good Luck!
-
Ok, I fixed the problem. You were right about REG_KEY. I defined it, but forgot to put the double slashes \\ I was just putting one. Thanks.
- Sean