PDA

Click to See Complete Forum and Search --> : Writing to registry


TheDarkSide
Jun 25th, 2002, 09:43 PM
I am trying to write to the registry. I can create a key, but not a value. can someone tell me what is wrong with this code?


HKEY hkey;
DWORD dmDisposition;

RegCreateKeyEx( HKEY_LOCAL_MACHINE, TEXT("Software\\My Company\\My App"), 0, 0, 0, 0, 0, &hkey, &dmDisposition );

DWORD dwType, cbData;
BYTE m_dwMaxFileSize;

dwType = REG_SZ;
cbData = sizeof(REG_SZ);

RegSetValueEx( hkey, TEXT("MaxFileSize"), 0, dwType, (PBYTE)"hi", cbData );

RegCloseKey(hkey);

Chris
Jun 25th, 2002, 11:32 PM
Check out the attached cpp/h files.

TheDarkSide
Jun 26th, 2002, 02:00 PM
thx works great :)