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.

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;
}

but the thing is it edits reads only strings... I want to read a value which has binary values.... How do I do that?

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.

commented: well done +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.