0

Am trying to Remove application from startup list but no success , error code is zero , so need help my function code is

string appName="someapp";
REGSAM flag = KEY_WOW64_64KEY; 
HKEY hkey = HKEY_LOCAL_MACHINE;
RegOpenKeyEx(HKEY_LOCAL_MACHINE,TEXT("SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run"),NULL, KEY_READ | KEY_WRITE | flag,&hkey);
RegDeleteValue(hkey,appName.c_str());
cout<<"\n error code is "<<GetLastError();
RegCloseKey(hkey);
darkworks
  • 65
  • 3
  • 10

1 Answers1

0

You have to delete the register key with a Windows API function, see register function reference, particularly RegDeleteKeyEx. The key in this case should be below HKEY_LOCAL_MACHINE, then SOFTWARE\Microsoft\Windows\CurrentVersion\Run. To check if they key exists, use RegOpenKeyEx.

Lundin
  • 174,148
  • 38
  • 234
  • 367