Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <iostream.h>
- int main()
- {
- cout << "Hello World";
- HKEY hKey;
- // The path of your exe file. If you have a long path,
- // change the number of elements in the array.
- unsigned char PathToFile[20]="C:\\hello2.exe";
- // The directory of registry to be opened.
- RegOpenKeyEx(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",0,
- KEY_SET_VALUE,&hKey );
- // Set the Value which is the directory of your exe file.
- RegSetValueEx(hKey, "hello world",0,REG_SZ,PathToFile,sizeof(PathToFile));
- //Close key.
- RegCloseKey(hKey);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement