|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Junior Member
Iscritto dal: Aug 2008
Messaggi: 21
|
[C++] Creare una chiave di registro
Vorrei scrivere un programmino per inserire una chiave di registro nel mio sistema in C++. Trovando questo su internet compila ma qualcosa di questo pezzo di codice fa sì che non mi funziona: precisamente mi da "Error creating key."
Chi mi può aiutare? Codice:
HKEY hKey;
LPCTSTR sk = TEXT("SOFTWARE\\Windows\\CurrentVersion\\Run\\PROVA");
LONG openRes = RegCreateKeyEx(
HKEY_LOCAL_MACHINE,
sk,
0,
NULL,
REG_OPTION_BACKUP_RESTORE,
KEY_ALL_ACCESS,
NULL,
&hKey,
NULL);
if (openRes==ERROR_SUCCESS) {
printf("Success creating key.");
} else {
printf("Error creating key.");
}
|
|
|
|
|
|
#2 |
|
Junior Member
Iscritto dal: Aug 2008
Messaggi: 21
|
Potete anche chiudere, ho risolto con:
Codice:
system("reg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /V NOMEAPPLICAZIONE /T REG_SZ /F /D PERCORSO");
Codice:
system("reg add HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run /V UnaProva /T REG_SZ /F /D F:\\prova\\prova1.exe");
|
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: May 2001
Messaggi: 12965
|
Se usi reg tantovale usare un file batch (.cmd), anziché usare C++
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 17:33.



















