Click here to Skip to main content
13,451,773 members (47,907 online)
Click here to Skip to main content
Add your own
alternative version


9 bookmarked
Posted 5 Feb 2002

CRegisterEx - a registry wrapper class

, 5 Feb 2002
Rate this:
Please Sign up or sign in to vote.
An easy to use all-in-one registry class
<!-- Download Links --> <!-- Add the rest of your HTML here -->


Always wanted a class that makes it easy to use the register? Well, I hope that you found it, right here! The class has some methods that you can use within your program. It's an easy to use class, and I hope you'll like it. 

The class was made using VC++.NET beta 2, but it should be compatible with VC++ 5 and 6.

The class is called CRegisterEx, guess why :)

How is this different to other Registry classes?

Many of the registry wrappers around don't have the functionality to save POINT and RECT structures. Thereby, most of them use RegSetValue instead of RegSetValueEx. The same goes for the Query.

This wrapper is really easy to use, and allows modification. I didn't include things that already were around, but if people like it, I will do it. So this class is an attempt to make an easy to use all-in-one Registry wrapper.


Construction is done with:

CRegisterEx (CString path);

where path stands for the rootpath. You must construct on the Heap, if you construct it on the Stack, memory leaks will occur!

The first two methods I'm going to explain are:

void WriteString(CString str, CString subPath, CString Key);
CString ReadString(CString subPath, CString Key);

With WriteString you can write a string to the register. This you must do by at least including a CString. subPath, which is used to generate a tree beneath the rootpath, and the Key attributes don't have to be included. Remember that the Key attribute will be set to "Standard".

With ReadString you can read a string from the register.

All other methods are based on these two methods. These are:

void WriteInteger(int i, CString subPath, CString Key);
int ReadInteger(CString subPath, CString Key);
void WritePoint(CPoint pt, CString subPath, CString Key);
CPoint ReadPoint(CString subPath, CString Key);
void WriteRect(CRect rect, CString subPath, CString Key);
CRect ReadRect(CString subPath, CString Key);
void WriteDouble(double dbl, CString subPath, CString Key);
double ReadDouble(CString subPath, CString Key);

As you can see, plenty of methods to use with your program.

If you've got something more to add, please use the forum field below.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

S van Leent
Web Developer
Netherlands Netherlands
I'm a developer in C++, however, I developed a lot in VB, Delphi and JAVA. Also I make web based applications using languages as PHP, ASP (JavaScript, VBScript), ASP.NET (C# and VB), JSP and Perl

Currently working in a small IT company.

You may also be interested in...

Comments and Discussions

GeneralExcellent example on how it shouldn't be done. Pin
jfernb27-May-04 10:57
sussjfernb27-May-04 10:57 
You need a beginners book on c++. No kidding.
GeneralRe: Excellent example on how it shouldn't be done. Pin
S van Leent27-May-04 12:16
memberS van Leent27-May-04 12:16 
GeneralYou have done well. Pin
magic world11-Jul-03 0:03
membermagic world11-Jul-03 0:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03-2016 | 2.8.180318.3 | Last Updated 6 Feb 2002
Article Copyright 2002 by S van Leent
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid