Here is my program. The errors it is giving me are:
line 27: passing `HKEY__ **' as argument 1 of `RegDeleteValueA(HKEY__ *, const CHAR *)'
line 29: passing `HKEY__ **' as argument 1 of `RegCloseKey(HKEY__ *)'
However, on MSDN, it tells me that the PHKEY can be passed to RegCloseKey.
Code:
#include <windows.h>
#include <iostream.h>
int main()
{ char csubkey[70],clpvaluename[70];
PHKEY phkResult;
long gooddelete;
int loop;
cout<<"Do you want to delete a registry value?"<<endl
<<"1 to delete, 0 to quit"<<endl;
cin>>loop;
while(loop)
{
cout<<endl<<endl<<"Name of subkey to delete:"<<endl;
cin>>csubkey;
cout<<"Name of value to delete:"<<endl;
cin>>clpvaluename;
RegOpenKeyEx(HKEY_CURRENT_USER,
csubkey,
0,0,
phkResult);
gooddelete=RegDeleteValue(phkResult,clpvaluename);
RegCloseKey(phkResult);
cout<<endl<<endl<<endl;
if (!gooddelete)
{cout<<"Delete successful";}
else
{cout<<"Delete unsuccessful";}
cout<<"Do you want to continue?"<<endl<<"1 to continue, 0 to quit";
cin>>loop;
}
return 0;
}