devi utilizzare le API di WIN32 (in neretto)
API Reference - downloadcodice:#include <windows.h> #include <stdio.h> int main() { // write HKEY hKey; //DWORD dwDisposition; //char szData[50]="C:\\mio_programma.exe"; // read char cStr[50] = "\0"; DWORD dwStr = 50; // create-insert a new string-value //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); //printf("Nuovo valore-stringa inserito in: HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run"); //system("PAUSE"); // read value RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", 0, KEY_ALL_ACCESS, &hKey); RegQueryValueExA(hKey, "nuovo_valore_stringa", NULL, NULL, (LPBYTE)cStr, &dwStr); RegCloseKey(hKey); printf("Valore presente in \"nuovo_valore_stringa\": %s\n", cStr); system("pause"); return 0; }
Le altre funzioni per interfacciarsi al registro
![]()

Rispondi quotando