Click here to Skip to main content
13,247,398 members (74,056 online)
Click here to Skip to main content
Add your own
alternative version


15 bookmarked
Posted 27 Nov 2007

Class to handle the Windows Registry operations

, 27 Nov 2007
Rate this:
Please Sign up or sign in to vote.
A class to handle the Windows registry more smoothly.


As most of the beginners are not well aware about the windows registery, they usually come with problems just by deleting the main nodes of windows, which leads to Windows to get hanged or even crash. And then, they got the crazy to start programming with the Windows registry. Windows Registry programming is extremely easy. There are two provisions provided by windows for doing this. One is using of SDK or MFC. But both cases we dont have a API that can create a node and set the value using a single API, which is one of the most important constraint in front of us. So to solve this, I came up with a solution to write a class that can do both creation as setting the value using a single API.


Beginners to windows programming are eager to get started with the Windows registry programming. While doing the programming and handling with registry, please be careful not to delete any important nodes that are essential for the working of windows. And for a beginner, I will say you to stick with SDK rather than MFC. I know both of these will not there in Windows Vista. But still SDK is the base for the Windows programmer.

Using the code

A brief description of how to use the article or code. The class names, the methods and properties, any tricks or tips.

Blocks of code should be set as style "Formatted" like this:

    CRegistry reg;
    DWORD dwData = 0;
//  This code will create a registry entry corresponding to this code.
    reg.CreateRegistryKey(HKEY_CURRENT_USER,_T( "Software\\MySoftware" ),hkey,dwData);
    reg. CreateAndSetValue( HKEY_CURRENT_USER, ,_T( "Software\\MySoftware" ),
              _T( "MyValue" ), _T( "Value1" ))

Points of Interest

Hope you all know what is a windows registry, We can call it as a configuration handling section. It is responsibility of the registry to keep all the configurations needed for the Windows to get worked proparly. Earlier days, INI files were used for the configuration handling, but it was never being a proper solution to keep the configurations in INI, since it got scattered here and there . So they are kept in a directory it can be called as Windows Registry. The registry also provides a window into the operation of the kernel, exposing runtime information such as performance counters and currently active hardware. This use of registry mechanism is conceptually similar to the way that Sysfs and procfs expose runtime information through the file system.


Please provide the feedback about the topic.


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

Software Developer
India India
If there is no way, make a way.
Believe me, you can do that.

In the software history, you can never find a software without bug, It is made the best after continuos attempts.

You may also be interested in...


Comments and Discussions

QuestionIs this any different? Pin
John M. Drescher27-Nov-07 7:19
memberJohn M. Drescher27-Nov-07 7:19 
AnswerRe: Is this any different? Pin
rajajay8227-Nov-07 17:59
memberrajajay8227-Nov-07 17:59 

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
Web01 | 2.8.171114.1 | Last Updated 27 Nov 2007
Article Copyright 2007 by rajajay82
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid