Solved

Easy question

Posted on 2001-06-08
3
1,150 Views
Last Modified: 2008-02-01
I wonder if someone could give me an example of RegDeleteValue.  I know the syntax, but seeing an acutal example
would be very helpful.

Say you want to delete HKCU\key\value what would the the RegDeleteValue paramiters be?

0
Comment
Question by:PastorDwayne
[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
  • 2
3 Comments
 
LVL 5

Expert Comment

by:alanwhincup
ID: 6169972
Try something like this:
If you want to delete a value in the key you spevified then do this:

  HKEY hregkey; // Declaring a key pointer for usage.
  long res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HKCU\\key", 0, KEY_ALL_ACCESS, &hregkey);
  if (res == 0)
  {
    RegDeleteValue(hregkey, "value") //Now let's delete the item value
  }
  RegCloseKey(hregkey);

If you want to delete the key you spevified then do this:

  RegDeleteKey(HKEY_LOCAL_MACHINE, "HKCU\\key\\Value");

Cheers,

Alan
0
 
LVL 5

Accepted Solution

by:
alanwhincup earned 50 total points
ID: 6169978
If you want to delete a value and check if its been deleted succesfully then replace:

RegDeleteValue(hregkey, "value")

with

if (RegDeleteValue(hregkey, "value") == ERROR_SUCCESS)
{
 // Do Whatever
}

in the above code.
0
 

Author Comment

by:PastorDwayne
ID: 6169981
Thanks, I think this should do it...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone 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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

696 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