Print Page | Close Window

CXTRegistryManager suggestion

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=12788
Printed Date: 23 June 2025 at 3:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTRegistryManager suggestion
Posted By: znakeeye
Subject: CXTRegistryManager suggestion
Date 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/



Replies:
Posted By: Oleg
Date 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


Posted By: znakeeye
Date Posted: 25 November 2008 at 8:42am
1. Yes, but the code code be cleaner ;)
2. ? :)


-------------
PokerMemento - http://www.pokermemento.com/


Posted By: Oleg
Date 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



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net