Solved

How do I rename a registry key using MFC

Posted on 2001-09-10
6
654 Views
Last Modified: 2013-11-20
I need to rename a particular registry key. Is there a single API function to do this? or Should I create my new registry key and copy the previous one into this and finally delete the original.
0
Comment
Question by:AmitAgarwal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 9

Accepted Solution

by:
Pacman earned 25 total points
ID: 6470279
Yes you have to copy and delete it.
0
 
LVL 2

Expert Comment

by:BogdyPtr
ID: 6470311
Yup, you have to copy the key.
You can use RegLoadKey and RegSaveKey to make the copy via a temp file.
You can use CRegKey::RecurseDeleteKey to delete all the subkeys more easy.
0
 
LVL 7

Expert Comment

by:peterchen092700
ID: 6470411
just to add some "manpower" to the statement: Copy&Delete is the only way, and even RegEdit implements it this way.

Peter
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Expert Comment

by:jhance
ID: 6470440
For 25 points you get the answer and you can code or locate an implementation yourself.

For 150-200 points, I'm sure someone would be happy to supply the source code to make this happen for you.
0
 
LVL 4

Author Comment

by:AmitAgarwal
ID: 6471445
Thanx a lot.
jhance there is no problem in implementing the code i was just wondering how this is not supplied as a single API.
i am giving point to Pacman because he was the first person to answer this. Thanks to everybody

love
amit
0
 

Expert Comment

by:sysaddix
ID: 7453833
According to MSDN:

RegSaveKey is often used in conjunction with RegRestoreKey to copy subtrees in the registry. An alternative to this approach is to use the SHCopyKey function.

I am currently trying to see if this will copy a key - then its just a two step approach.

mjdalways
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question