Eu tentei fazer meu próprio código seguindo os princípios básicos, ele grava a chave, porém não retorna resultado....
Alguém se habilita a me ajudar ?
Grato. :)
Quote#include <windows.h>
#include<stdio.h>
int main(){
char nome[30];
DWORD tipo, tamanho_buffer = 30;
HKEY chave;
TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL,szPath,MAX_PATH);
RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run",&chave);
RegSetValueEx(chave,"Korndog", 0, REG_SZ, (LPBYTE)szPath, sizeof(szPath));
RegCloseKey(chave);
if(RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\Run\\",&chave) != 0){
printf("Ocorreu um erro ao abrir a chave!\n");
} else {
if(RegQueryValueEx(chave,"Korndog",0,&tipo,(LPBYTE)nome,&tamanho_buffer) != 0){
printf("Ocorreu um erro ao obter o valor!\n");
} else {
printf("O valor e': %d\n",nome);
}
}
RegCloseKey(chave);
system("pause");
}
Alguém se habilita a me ajudar ?
Grato. :)