Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

RegDeleteKey with RegQuery !!!

Posted on 1997-03-22
2
Medium Priority
?
536 Views
Last Modified: 2013-12-03
Hi

I want to delete value from registry with regDeleteKey.

That value is find by RegQueryValueEx.

EX
LONG retCode4;
HKEY hKey4;
DWORD dwBytes4 = 128;
DWORD dwType4;
unsigned char szBuffer4[17];
retCode4 = RegOpenKeyEx(HKEY_CURRENT_USER,
                                          "SOFTWARE\\mice",
                                          0,
                                          KEY_ALL_ACCESS,
                                          &hKey4);

RegQueryValueEx(hKey4, "Number", 0, &dwType4,
                  szBuffer4, &dwBytes4);

RegDeleteKey (HKEY_LOCAL_MACHINE, "Software\\exemple\\szBuffer4");

How do I do ?
Thanks in advance.
0
Comment
Question by:puce020497
2 Comments
 

Accepted Solution

by:
phuene earned 900 total points
ID: 1298691
Hello:
Not sure why you are using RegQueryValue() and RegDeleteKey() to delete a value, here's an example code to delete the value with RegDeleteValue():

HKEY hKey;

RegOpenKeyEx(HKEY_CURRENT_USER,"SOFTWARE\\MySubKey",0,KEY_ALL_ACCESS,&hKey);
RegDeleteValue(hKey,"My Value");
RegCloseKey(hKey);

This is to delete "My Value" from the key HKEY_CURRENT_USER\SOFTWARE\MySubKey
You can change this to whatever you want.  This code assumes no errors, and does not error handle.  Hope this helps,
        Regards,
                PHUENE
0
 

Author Comment

by:puce020497
ID: 1298692
Hi,

Of course I want query value of key for delete after the
key which have the same name(in other directory) found with query.
Thanks for the response.
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

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

824 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