FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
#1
|
|||
|
|||
Error! Crear valor en el registro
Hola a todos,
estoy tratando de crear una clave en el registro de windows, pero me lanza un error al momento de crearla, agrego que la compilación fue sin error, estuve viendo otros hilos abiertos en la página y logro solucionarme una parte pero lo principal no puedo, a ver si me dan una manito, les dejo los códigos que están en mi problema: Primeramente empezare con "Leer un valor de una clave": con este código puedo leer sin problemas: Código:
void __fastcall TForm1::Button1Click(TObject *Sender) { TRegistry *Registry = new TRegistry(KEY_ALL_ACCESS); Registry->RootKey = HKEY_CURRENT_USER; // Poner true si queremos que cree la clave si ésta no existe if(Registry->KeyExists("Software\\Microsoft\\Windows\\CurrentVersion\\Run")) { Registry->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run",false); ShowMessage(Registry->ReadString("miprograma")); Registry->CloseKey(); } } Código:
void __fastcall TForm1::Button1Click(TObject *Sender) { TRegistry *Registry = new TRegistry(KEY_ALL_ACCESS); Registry->RootKey = HKEY_LOCAL_MACHINE; if(Registry->KeyExists("Software\\Microsoft\\Windows\\CurrentVersion\\Run")) { Registry->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run",false); ShowMessage(Registry->ReadString("miprograma")); Registry->CloseKey(); } } Código:
void __fastcall TForm1::Button1Click(TObject *Sender) { // esta linea hace que me muestre la clave, diferenciando mi SO actual (WIndows 7 64 bits) std::auto_ptr<TRegistry> rRegistro(new TRegistry(KEY_READ | KEY_WOW64_64KEY)); rRegistro->RootKey = HKEY_LOCAL_MACHINE; if(rRegistro->KeyExists("Software\\Microsoft\\Windows\\CurrentVersion\\Run")) { rRegistro->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run",false); ShowMessage(rRegistro->ReadString("miprograma")); rRegistro->CloseKey(); } } clubdelphi.com/foros/showpost.php?p=468929&postcount=9 amolde el código para crear llaves, pero aún asi no puedo crearlas en "HKEY_LOCAL_MACHINE", solo puedo en "HKEY_CURRENT_USER", este es el código: Código:
std::auto_ptr<TRegistry> Registry(new TRegistry(KEY_READ | KEY_WOW64_64KEY)); Registry->RootKey = HKEY_LOCAL_MACHINE; if(Registry->KeyExists("Software\\Microsoft\\Windows\\CurrentVersion\\Run")) { Registry->OpenKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run",false); Registry->WriteString("miprograma2","C:\\Video tutoriales\\registro\\pregistro.exe"); Registry->CloseKey(); } ShowMessage("Listo"); Saludos. |
|
|
Temas Similares | ||||
Tema | Autor | Foro | Respuestas | Último mensaje |
REG_DWORD leer y escribir un valor en el registro | madmai | Lazarus, FreePascal, Kylix, etc. | 1 | 01-02-2010 08:43:46 |
como obtener valor del ultimo registro. | Gaim2205 | Varios | 4 | 10-09-2007 22:02:17 |
Maxima valor de un nuevo registro | Arturo_ | Tablas planas | 8 | 23-07-2007 22:14:32 |
Registro con valor BINARIO !!! | Ledian_Fdez | Varios | 1 | 07-06-2007 00:25:58 |
Error: El valor EOF o BOF es True o el actuañ registro de eliminó | lavtaro | Conexión con bases de datos | 2 | 30-06-2003 11:39:44 |
|