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
  • 12
  • Similar question? http://stackoverflow.com/questions/43116/how-can-i-run-an-external-program-from-c-and-parse-its-output – Makis Feb 06 '13 at 13:36
  • @Makis What??? Surely you posted the wrong link. – Lundin Feb 06 '13 at 14:55
  • I thought he wants the output from another application ("how we are going to get back result from system command"). – Makis Feb 06 '13 at 22:07
  • @Makis ya thats problem .... well anyother idea how to remove application from startup list using c++ – darkworks Feb 08 '13 at 08:42
  • Alright, I yield, the English in this question is too strange for me to comprehend... – Lundin Feb 08 '13 at 09:25

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
  • 195,001
  • 40
  • 254
  • 396