Solved

How do I rename a registry key using MFC

Posted on 2001-09-10
6
638 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
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
method notes when mouse over in eclipse 5 68
sum67 challenge 35 89
mapBully challenge 6 93
Detect file exist or not 3 83
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now