?
Solved

RegQueryKey and RegDeleteKey (4)

Posted on 1997-05-07
1
Medium Priority
?
2,038 Views
Last Modified: 2012-08-13
Hello,

I wrote already for the same question but I never receipt response.

How to delete a key in the registry found by RegQueryValue.

Ex : in the key HKEY_CURRENT_USER\\Software\\xyz , the value of reg (by example ) is 32568
I want delete the key HKEY\\LOCAL_MACHINE\\Software\\32568

I'm want delete key that is value !!!!! Thanks. The value is the Key !!!!



How do I do ?

Thanks
0
Comment
Question by:puce020497
[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
1 Comment
 
LVL 1

Accepted Solution

by:
shappir earned 100 total points
ID: 1163347
First thing first, there is no Win32 API function called RegQueryKey ! You either mean RegQueryInfoKey
or RegQueryValueEx. As to your question, if I understand correctly you want to delete a key called 32568
that is a subkey of HKEY_LOCAL_MACHINE\Software. What you should do is open HKEY_LOCAL_MACHINE\Software using RegOpenKeyEx and then use RegDeleteKey:

HKEY hKey;
if ( RegOpenKeyEx(HKEY_LOCAL_MACHINE,                  TEXT("Software"), 0,                  KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS ) {
  RegDeleteKey(hKey, TEXT("32568"));
  RegCloseKey(hKey);
}

Note that if 32568 has subkeys this will not work on all versions of Windows NT. If you must also support these platforms you must write a recursive decent and delete routine. If 32568 is actually a value use RegDeleteValue instead of RegDeleteKey.

0

Featured Post

Technology Partners: 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

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

762 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