The author's statement: This article has already put it on the day website. Without permission, I do not reprint IE is the most browser used in Windows platform, so how do I use the program to modify IE, create my own features?
I am here to modify IE through the registry.
First we are familiar with the methods and functions of modifying the registry in C #. The Registry class is provided in the VC #, the RegistryKey class implements the operation of the registry. Where the Registry class encapsulates seven basic principals of the registry:
Registry.ClassesRoot corresponding primary key HKEY_CLASSES_ROOT HKEY_CURRENT_USER Registry.CurrentUser corresponding to the primary key Registry.LocalMachine corresponding to the primary key HKEY_LOCAL_MACHINE Registry.User HKEY_USER corresponding primary key corresponding to HEKY_CURRENT_CONFIG Registry.CurrentConfig Registry.DynDa primary key corresponding to the primary key Registry.PerformanceData HKEY_DYN_DATA corresponding to the primary key HKEY_PERFORMANCE_DATA RegistryKey The class packages the basic operations of the registry, including reading, writing, deletion. The main functions of reading are:
The OpenSubKey method is mainly to open the specified subkey. The getSubKeynames () method is to get the name of all sub-keys under the main key, and its return value is a string array. The getValuenames () method is to get all the names in the current subkey, and its return value is also a string array. GetValue (String Name) method is the key value of the specified key. The write function is: createSubkey (String Name) method is to add a subkey
SetValue (String Name, String Value) method is the key value for setting a key
Deleted functions:
DELETESUBKEY () Method: Delete a specified subkey. DELETESUBKEYTREE () Method: This method is to completely delete the specified sub-key directory, ie, delete the subkey and the entire sub-key below the subkey. You can modify IE through the registry, here I briefly introduce several commonly used modifications to IE.
If we want to open or close the IE window, the opened window has a dynamic effect, then you can open the HKEY_ CURRENT_USER / Control Panel / Desktop / WindowMetrics key, and create a new string value "MINanimat" with "MAXANIMAT" in the window on the window. Set the value of "0", "1", so that there is a change in the handover at the maximum switching of the IE window.
If we change to the toolbar of IE, add the background, then expand your hkey_current_user \ Software\Microsoft \Internet Explorer \Toolbar key value, the Explorer primary key newly created a string value called "backbitmap", and modifies its value to the preparation of BMP The full path and file name of the picture; so we have completed the purpose of adding a background image for the toolbar for IE.
The method implemented with C # programming is as follows:
1. The dynamic effect of IE window
// -------------------------------------
// changeie.cs © 2004 by yudehui
// -------------------------------------
Using system;
Using microsoft.win32; // You must reference this namespace to the registry operation
Namespace Changeie
{
Class Changeie
{
[Stathread]
Static void
Main
(String [] ARGS)
{
RegistryKey PregKey;
PregKey = registry.currentuser.opensubkey ("Control Panel // Desktop // WindowMetrics", True;
IF (pregKey == NULL)
{
Console.WriteLine ("key value does not exist");
}
Else
{
PregKey.SetValue ("MINANIMATE", "1");
PregKey.SetValue ("MAXANIMATE", "1");
Console.WriteLine ("Modify Success");
}
PREGKEY.......
}
}
}
2. Change the background of the IE toolbar
// -------------------------------------
// changeie.cs © 2004 by yudehui
// -------------------------------------
Using system;
Using microsoft.win32; // You must reference this namespace to the registry operation
Namespace ChangeiebackColor
{
Class ChangeiebackColor
{
[Stathread]
Static void
Main
(String [] ARGS)
{
RegistryKey PregKey;
PregKey = registry.currentuser.opensubkey ("Software // Microsoft // Internet"
"Explorer // Toolbar // Explorer", True);
IF (pregKey == NULL)
{
Console.WriteLine ("key value does not exist");
}
Else
{
PregKey.SetValue ("Backbitmap", "C: //Windows//greenstone.bmp");
Console.WriteLine ("Modify Success");
}
PregKey.Close;
}
}
}
The above two simple examples are only simple settings for IE. I believe that everyone has a certain understanding of the operation of the registry under C #. Interested readers can make more personalized modifications to IE, and the above code is debugged under Windows2003 VS.NET2003.
Note: It is necessary to operate in the registry, and then back up, to prevent errors, and cause the system to crash.
Author Blog:
http://blog.9cbs.net/yudehui/