NO

Author Topic: write registry  (Read 4388 times)

tesla

  • Guest
write registry
« on: April 23, 2008, 09:38:13 PM »
Is there a relatively simple and safe way to write a value to the registry?  Do I need to check for the registry key first and create it if it doesn't exist?

Thanks!

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: write registry
« Reply #1 on: April 23, 2008, 10:04:55 PM »
See Registry (Windows) at the MSDN.
---
Stefan

Proud member of the UltraDefrag Development Team

tesla

  • Guest
Re: write registry
« Reply #2 on: June 27, 2008, 09:00:04 PM »
Making some progress :)

I am writing data into registry at expected location.  But the data is not showing as expected, I just see blocks when using PHM Registry Viewer.  Also the compiler seems to require a lot of parameters to be Unicode (I think?).

For example param #2 in the reg create complained until I put the L modifier on it...

Code: [Select]
  HKEY hk;
  char Value[1024];

  RegCreateKeyEx(HKEY_CURRENT_USER,L"Software\\test",0,NULL,REG_OPTION_NON_VOLATILE,KEY_WRITE,NULL,&hk,NULL);

  //_snwprintf(wchBuf, NELEMS(wchBuf), L"%f", x);
  sprintf(Value,"%f",x);
  RegSetValueEx( hk, L"x", 0, REG_SZ, Value, strlen(Value)+1 );

  RegCloseKey(hk);

iancasey

  • Guest
Re: write registry
« Reply #3 on: August 26, 2008, 12:05:02 AM »
I know this is an older thread, but I thought I'd add my 2 cents.

I like to keep all my programs and data on an SD disk, this is because I keep forgetting to recharge the ppc.
If you have had a PPC for very long then most likely you have needed to hit the reset button or left it to the point the backup battery died.
I'm not sure if this this resets the registry but why take the chance ( I don't).
If you use external memory (SD card) then why not write to an ini file in the default program folder?

Ian