?
Solved

How do I rename a registry key using MFC

Posted on 2001-09-10
6
Medium Priority
?
656 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 75 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 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