-
C++ (
http://www.daniweb.com/forums/forum8.html)
| krnekhelesh | Nov 25th, 2007 5:27 am | |
| Editing Windows Registry I want to create a C++ Program to edit the Windows Registry. For example to change the home page of internet explorer. But I don't know how to read or edit the help.
I am doing this program just for my own self and is not a part of homework. |
| krnekhelesh | Nov 25th, 2007 5:34 am | |
| Re: Editing Windows Registry I got the following source from the internet... but I don't know how to manipulate it for my convience
#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;
} |
| krnekhelesh | Nov 25th, 2007 5:35 am | |
| Re: Editing Windows Registry but the thing is it edits reads only strings... I want to read a value which has binary values.... How do I do that? |
| vijayan121 | Nov 25th, 2007 6:32 am | |
| Re: Editing Windows Registry you still use RegQueryValueEx.
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 ); see http://msdn2.microsoft.com/en-us/library/ms724884.aspx for the registry value types. |
| All times are GMT -4. The time now is 7:21 am. | |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC