?
Solved

Easy question

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

Independent Software Vendors: 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

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
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

764 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