Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTRegistryManager suggestion
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTRegistryManager suggestion

 Post Reply Post Reply
Author
Message
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Topic: CXTRegistryManager suggestion
    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/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2008 at 7:13am

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
Back to Top
znakeeye View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 July 2006
Status: Offline
Points: 1672
Post Options Post Options   Thanks (0) Thanks(0)   Quote znakeeye Quote  Post ReplyReply Direct Link To This Post Posted: 25 November 2008 at 8:42am
1. Yes, but the code code be cleaner ;)
2. ? :)
PokerMemento - http://www.pokermemento.com/
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 26 November 2008 at 3:16am
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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.184 seconds.