codice:
#include <windows.h>
#include <stdio.h>
int main()
{
HKEY hKey;
DWORD dwDisposition;
char szData[50]="C:\\mio_programma.exe";
RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, &dwDisposition);
RegSetValueEx(hKey, "nuovo_valore_stringa", 0, REG_SZ, (LPBYTE)szData, sizeof(szData));
RegCloseKey(hKey);
system("PAUSE");
return 0;
}
ad esempio, questo codice aggiunge alla chiave RUN del registro...
un nuovo valore stringa che ha la funzione di lanciare un programma all'avvio di windows.
p.s. scaricati da qua la Reference alle API di Win32: http://www.opcode.it/win32APIreference.zip