| | |
Editing Windows Registry
![]() |
I got the following source from the internet... but I don't know how to manipulate it for my convience
C++ Syntax (Toggle Plain Text)
#include <windows.h> #include <iostream> int main () { HKEY hKey; // Declare a key to store the result DWORD buffersize = 1024; // Declare the size of the data buffer char* lpData = new char[buffersize];// Declare the buffer /* Open the Registry Key at the location HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main with read only access */ RegOpenKeyEx (HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer\\Main",NULL,KEY_READ,&hKey); // Query the registry value RegQueryValueEx(hKey,"Start Page",NULL,NULL,(LPBYTE) lpData,&buffersize); // Print out the registry value std::cout << "Registry Key Open: memory location=" << hKey << "\n"; std::cout << "Your Internet Start Page is " << lpData << "\n\n"; // Close the Registry Key RegCloseKey (hKey); // Pause the system so there is time to read what is going on system("Pause"); delete lpData; }
Last edited by krnekhelesh; Nov 25th, 2007 at 5:34 am. Reason: code error
Ubuntu Linux User #25732
•
•
Join Date: Dec 2006
Posts: 1,089
Reputation:
Solved Threads: 164
you still use RegQueryValueEx.
see http://msdn2.microsoft.com/en-us/library/ms724884.aspx for the registry value types.
C++ Syntax (Toggle Plain Text)
LONG WINAPI RegQueryValueEx( HKEY hKey, LPCTSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, // will be set to the type of data // (eg. REG_BINARY if value was binary) LPBYTE lpData, LPDWORD lpcbData );
Last edited by vijayan121; Nov 25th, 2007 at 6:33 am.
![]() |
Similar Threads
- Editing windows registry (VB.NET)
- bridge.dll and unable to download (Viruses, Spyware and other Nasties)
- Windows Registry Problems (Windows Software)
- Error trapping while reading windows XP registry entries (Python)
- POSSIBLE windows registry error - urgent attention (Windows NT / 2000 / XP)
Other Threads in the C++ Forum
- Previous Thread: c2440 error??
- Next Thread: Help with creating a class
| Thread Tools | Search this Thread |
api array based binary bitmap c++ c/c++ char class classes code coding compaitibility compile console conversion count delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error factorial file floatingpoint forms fstream function functions game givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker loop looping loops map math matrix memory multiple net news node number numbertoword output parameter payment pointer problem program programming project projectassignmenthelp protection python random rank read recursion reference rpg skills string strings temperature template test text text-file tree url variable vector video win32 windows winsock word wordfrequency wxwidgets






