Posted By

the_coder on 06/29/11


Tagged

c winapi autostart Registery


Versions (?)

Register Autostart Application


 / Published in: C
 

  1. //nfilename: the path to the application
  2. //keyname: the name to appear in the registery
  3. void AutoStartRegs(char *nfilename, char *keyname)
  4. {
  5. HKEY key;
  6.  
  7. RegCreateKeyEx(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, NULL);
  8. RegSetValueEx(key, keyname, 0, REG_SZ, (const unsigned char *)nfilename, strlen(nfilename));
  9. RegCloseKey(key);
  10.  
  11. return;
  12. }

Report this snippet  

You need to login to post a comment.