Aug 15, 2014 at 4:30pm UTC
Hi everyone,
I'm trying to delete a windows registry key and all its subkeys, specifically the 'Open with SHCP' key (which I created) and all its subkeys and values. I have the code, but it throws me this error:
'RegDeleteTree' was not declared in this scope
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
HKEY hKey;
cout << "Deleting Tree:\n\n" ;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,"SOFTWARE\\Classes\\*\\shell" , 0, KEY_ALL_ACCESS, &hKey)== ERROR_SUCCESS)
{
cout << "Successfully opened key\n" ;
if (RegDeleteTree(hKey,"Open with SHCP" ) == ERROR_SUCCESS)
{
cout << "Successfully deleted the key\n" ;
}
else
{
cout << "Failed to delete the tree\n" ;
}
RegCloseKey(hKey);
}
else
{
cout << "Error, no tree available\n" ;
}
cin.get();
return 0;
}
I'm using Windows 7 and Dev-C++ 5.6.3
Also, I'm able to use other fuctions like
RegOpenKeyEx
and
RegCreateKeyEx
.
Can someone point out what is wrong or missing with my code?
Last edited on Aug 15, 2014 at 4:31pm UTC