Disclaimer: This article has already put it on the sky website, here is just collection. repost is not allowed without consent
IE is the most browser in the Windows platform, so how do I use the program to modify IE, create IE with my own characteristics?
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
The RegistryKey class encapsulates the basic operations of the registry, including read, write, and delete. 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 functions are:
CreateSubKey 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 subkey 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 microsoft.win32 ;? // Do you want to reference this namespace for 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 ("MINAANIMATE", "1");
??????????????? pregKey.SetValue ("MAXANIMATE", "1");
??????????????? console.writeLine ("Modified Success");
?
???????????}
??????????? pregKey. close;
???????}
???}
}
2. Change the background of the IE toolbar
// -------------------------------------
//? Changeie.cs © 2004 by Yudehui
// -------------------------------------
Using system;
Using microsoft.win32 ;? // Do you want to reference this namespace for 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 ("Modified 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.
?