write to registry
-
hey, how would I make changes to the windows registry, I need to change values of a predefined key when ever it runs.. thank you
-
-
Dieser Thread wurde von Moderator/in davie aus dem Forum C++ in das Forum WinAPI verschoben.
Im Zweifelsfall bitte auch folgende Hinweise beachten:
C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?Dieses Posting wurde automatisch erzeugt.
-
sorry
well I read that faq, and this is what I got out of it, but it is not working:
#include <conio.h> #include <stdio.h> char main() { HKEY hKey; RegCreateKeyEx(HKEY_LOCAL_MACHINE, "\\Software\\...\\ZoneMap\\Domains\\blah.org", 0, 0, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, zero, &hkey, 0); RegCloseKey(hKey); printf("Done"); getch(); return 0; }
any help getting this to work?? Thanks in advance
BTW: I'm trying to add that string value to the registry under the specified key and hive.. thanks
-
Hi,
look at this:char String[16] = ""; HKEY hKey = HKEY_LOCAL_MACHINE; LPCTSTR subKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"; long lStatus; DWORD *lpDisposition = NULL; lStatus = RegCreateKeyEx(hKey, subKey, 0, "", REG_OPTION_NON_VOLATILE, KEY_READ | KEY_WRITE, NULL,&hKey,lpDisposition); lStatus = RegSetValueEx(hKey, "REG_VALUE_NAME", 0, REG_SZ, (CONST BYTE*)String, strlen(String)+1); lStatus = RegFlushKey(hKey); RegCloseKey(hKey);
I hope I could help you with this!
greetz
-
you certainly did, thanks alot