Solved

How do I rename a registry key using MFC

Posted on 2001-09-10
6
655 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
Independent Software Vendors: 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

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!

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

707 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