-
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);
-
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
-
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.
-
Re: please help registry
The 6th parameter of RegCreateKeyEx is the desired access mode. You are passing 0. Try using KEY_SET_VALUE.