Page 1 of 1

Write Registry Key

Posted: Mon Jan 23, 2006 6:11 pm
by garylyb
I'm having a terrible time writing a registry key.

Here is the sequence:

Read Registry Key HKLM\\Software\\Quotes Plus\\Setup\\components\\Data\\Installed into INSTALLEDDATA
.
.
INSTALLEDDATA = $INSTALLEDDATA$ or 1
.
.
INSTALLEDDATA = $INSTALLEDDATA$ or 2
.
.
INSTALLEDDATA = $INSTALLEDDATA$ or 4
.
.

Everything works up to this point, the watch window shows a value of 7 for INSTALLEDDATA



I've tried both of these write statements, and nothing ever gets written to the registry.


Write Registry Key HKLM\\Software\\Quotes Plus\\Setup\\components\\Data\\Installed, INSTALLEDDATA

Write Registry Key HKLM\\Software\\Quotes Plus\\Setup\\components\\Data\\Installed, $INSTALLEDDATA$


INSTALLEDDATA is a DWORD in the registry. I've also tried a string, nothing ever gets written.





This key works fine:

Read Registry Key HKLM\\Software\\Quotes Plus\\Setup\\DataDir into DATADIR
.
.
The value is changed in a dialog box.
.
.
Write Registry Key HKLM\\SOFTWARE\\Quotes Plus\\Setup\\DataDir, $DATADIR$




I'm using the Ponderosa build, just downloaded from the web.


I've spent all day on this, and can't get any farther until I can write to the registry.

Gary Lyben

Posted: Mon Jan 23, 2006 6:13 pm
by CandiceJones
Are you testing for writes after Apply Install executes?

Posted: Mon Jan 23, 2006 6:21 pm
by garylyb
"Are you testing for writes after Apply Install executes?"


I don't know what that means.

The write registry commands are both before apply install.

Posted: Mon Jan 23, 2006 6:38 pm
by CandiceJones
It sounded to me like you are stepping through the debugger. Wait for Apply Install to execute - only then will your changes actually apply to the system, including writing to the registry.

Posted: Mon Jan 23, 2006 8:23 pm
by garylyb
OK, I think I got it now, if the registry key didn't exist, the read returns a null string. Every subsequent operation on a null string silently fails.

If I check for the null, and set it to 0, then the code works as expected.

Thanks, everyone sure responded quickly on this, I'm impressed.

Best regards,

Gary Lyben