Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

create registry keys? problem

$
0
0
hi i have the following code but the problem is 
that when i run it it returns error_success
when in fact it doesn't actually edit the registry. i have admin access
so this is not a problem

HKEY hkey;
char * strPath = "notepad.exe";

if (RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,KEY_WRITE,&hkey) == ERROR_SUCCESS)
{
if(RegSetValueEx(hkey,"YourProgName",0,REG_SZ,(LPBYTE) strPath,sizeof(strPath)) == ERROR_SUCCESS){
RegCloseKey(hkey);

cout << "error success" << ERROR_SUCCESS << endl;

system("pause");

}
}


        return 0;


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>