I'm using the WIN32 API, not the MFC but I've got a problem my program has a settings dialog and i need to keep a integar saved for the next time the program is used. I'm going to use the Registry to do this but I create a key set it's value then request the value and ouput the value but instead of the original value being output i get a number Around 150,000 instead. Heres my code:
int value = 1234;
buffersize = 4;
sprintf(bufferedvalue,"The value is: %d",outputvalue);
Also, I seriously doubt that you want to store data at the place you are. Configuration data common to all users is typically stored at:
while data specific to each user is stored under HKCU:
"HKLM\Software\Your Company\Your Program\"
Even for services.
"HKCU\Software\Your Company\Your Program\"
I figured out how to fix the problem myself (set the sixth param of RegSetValue() to sizeof(DWORD)) but thanx for the Registry Path tip.