Solved

RegQueryKey and RegDeleteKey (4)

Posted on 1997-05-07
1
2,023 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 50 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

687 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