|
-
February 15th, 2008, 03:41 PM
#1
please help registry
i made this code, but did not work. I want to put some data to registry, more exactly a path. Tho code make a key, but did not set the value. Please help
HKEY hkey;
DWORD dwDisposition;
unsigned char boum[7] = "chaine";
int dwSize = sizeof (DWORD);
RegCreateKeyEx(HKEY_LOCAL_MACHINE, TEXT("Software\\My Company\\My Application"), 0, NULL, 0, 0, NULL, &hkey, &dwDisposition);
RegSetValueExA(hkey, "La Chaine", NULL, REG_SZ, (LPBYTE)&boum, dwSize);
-
February 15th, 2008, 04:10 PM
#2
Re: please help registry
http://msdn2.microsoft.com/en-us/library/aa911940.aspx
And, what is the return value of "RegCreateKeyEx"? Did it succeed?
Viggy
-
February 18th, 2008, 05:19 AM
#3
Re: please help registry
Did you read the documentation? The first very parameter that you should supply RegSetValueEx should be a handle to an open registry key. I don't see you opening a key, but you are right out trying to set a value. Neither do you check if the call to RegSetValueEx succeeded. May be you should see a sample in MSDN which explains the usage of this call.
Nobody can give you wiser advice than yourself. - Cicero
Rajesh Subramanian.
Codeproject.com: Visual C++ MVP
-
February 22nd, 2008, 12:51 AM
#4
Re: please help registry
The 6th parameter of RegCreateKeyEx is the desired access mode. You are passing 0. Try using KEY_SET_VALUE.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|