-
Registry
I am trying to get my program to load its startup information from the Windows registry. I can load integers correctly by using the following code:
RegEnumValue(hKey, Index, Buffer, &BufSize, NULL, &Type, &Data, &Size);
When I try to get the value of a string like this:
RegEnumValue(hKey, 5, Buffer, &BufSize, NULL, &Type, &Data, &Size);
strcpy(Option.FontName, Data);
I get an error message.
How can I load a string from the registry?
-
Code:
const char *keyName = "myStringValueName";
char *buffer = new char[256];
DWORD bufferSize = 256;
RegQueryValueEx(globalKey, keyName, NULL, NULL, (LPBYTE)buffer, &bufferSize);
And of course,
-