[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Easy question

Posted on 2001-06-08
3
Medium Priority
?
1,163 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 200 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

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 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 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

649 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