CXTRegistryManager suggestion |
Post Reply |
Author | |
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
Posted: 25 November 2008 at 5:00am |
Suggestion #1
Sometimes you want registry keys to always be present in the registry. This makes it easier for users to edit some special settings!
I think you should have an extra parameter in the CXTRegistryManager constructor:
BOOL bPersistentValues = TRUE;
CXTRegistryManager reg(HKEY_LOCAL_MACHINE, bPersistentValues);
int value = reg.GetProfileInt("Settings", "Value", 0);
After the call to GetProfileInt, the key/value will be created, hence readable by a user!
This behavior is disencouraged most of the time, so the second parameter should default to FALSE!
Suggestion #2 Also, I think it should be possible to set the registry key and profile name directly in the constructor. We have multiple products accessing each other's profiles, and it would be very convenient if you could type the following:
CXTRegistryManager reg(HKEY_LOCAL_MACHINE, TRUE);
and a second constructor:
CXTRegistryManager reg(HKEY_LOCAL_MACHINE, "RegistryKey", "ProfileName", TRUE);
The code gets bloated if you need to call SetRegistryKey (or similar) all the time! |
|
PokerMemento - http://www.pokermemento.com/
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, 1. its easy to emulate it:
int nValue = reg.GetProfileInt("Settings", "Value", -1);
if (nValue == -1) reg.WriteProfileInt("Settings", "Value", 0), nValue = 0;
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
znakeeye
Senior Member Joined: 26 July 2006 Status: Offline Points: 1672 |
Post Options
Thanks(0)
|
1. Yes, but the code code be cleaner ;)
2. ? :)
|
|
PokerMemento - http://www.pokermemento.com/
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
To create cleaner code add 2 members GetProfileInt and WriteProfileInt and call CXTRegistryManager + future SetRegistryKey + reg.GetProfileInt/reg.WriteProfileInt .
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |