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:
Code:
int value = 1234;
HKEY hk;
int outputvalue;
char bufferedvalue[100];
DWORD dwDisposition,buffersize;
buffersize = 4;
RegCreateKeyEx(HKEY_LOCAL_MACHINE,"SYSTEM\\CurrentControlSet\\Services\\EventLog\\program\\Settings",
0,NULL,0,KEY_ALL_ACCESS,NULL,&hk,&dwDisposition);
RegSetValueEx(hk,TEXT("num"),0,REG_DWORD,(LPBYTE)value,sizeof(value));
RegQueryValueEx(hk,TEXT("num"),NULL,NULL,outputvalue,&buffersize);
sprintf(bufferedvalue,"The value is: %d",outputvalue);
MessageBox(NULL,bufferedvalue,"Result",MB_OK);
cal