Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. /*
  2. * Coded by Aker15
  3. * Add file to startup.
  4. */
  5.  
  6. #include "stdafx.h" // erase if not using MVC++
  7. #include <stdio.h>
  8. #include <Windows.h>
  9.  
  10. int _tmain(int argc, _TCHAR* argv[])
  11. {
  12. HKEY hkey;
  13. const char* szPath = "Robot";
  14.  
  15. //DWORD fName = GetModuleFileName(NULL, (TCHAR *)szPath, sizeof(szPath));
  16.  
  17. if(RegCreateKey(HKEY_CURRENT_USER, L"Software//Microsoft//Windows//CurrentVersion//Run", &hkey) == 0)
  18. {
  19. RegSetValueEx((HKEY)hkey, L"RoBoT", NULL, REG_SZ, (BYTE *)szPath, strlen(szPath));
  20. }
  21. else
  22. {
  23. printf("%s", GetLastError());
  24. }
  25. puts("Successful!");
  26. RegCloseKey(hkey);
  27. getchar();
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement