#include <windows.h>
#include <stdio.h>
int main() {
HKEY hKey;
char path[MAX_PATH];
DWORD pathSize = sizeof(path);
// Get the current executable's path
GetModuleFileName(NULL, path, pathSize);
// Open the registry key for the current user's startup programs
RegOpenKey(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Run", &hKey);
// Set the registry value to the executable's path
RegSetValueEx(hKey, "YourApplicationName", 0, REG_SZ, (BYTE*)path, pathSize);
// Close the registry key
RegCloseKey(hKey);
return 0;
}