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.

9 Years
Discussion Span
Last Post by vijayan121
Featured Replies
  • 1

    you still use RegQueryValueEx. [CODE]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 );[/CODE] see [url]http://msdn2.microsoft.com/en-us/library/ms724884.aspx[/url] for the registry value types. Read More


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

	"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

	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?

This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.