Use VBScript to customize the code of the IE Toolbar button
Source: Internet
Author: User
The buttons on the IE Toolbar are not Microsoft's patents. ordinary users can also customize them and add the buttons they want to set. As for how to add them, many materials have been introduced. There are two specific implementation methods: one is to use lengthy and complex VC or VB code programs, which is a little too high for common users, it is usually difficult to achieve the goal. Second, it is done manually. However, this method is extremely insecure because the system registry must be greatly modified, if you are not careful, you will be self-defeating, so that you can reinstall the system!
I will introduce a compromise method here. I use VBScript to make the IE Toolbar buttons. It does not require lengthy and complex program code, but does not require tedious modification of the system registry, however, the self-made IE Toolbar buttons can also be achieved.
Whether you use VB or VC or manually add a button, you have to modify the system registry. VBScript is no exception, but its code is simple and easy to understand. To change the registry, you must know the path of the operation target in the registry. The path of IE's self-made toolbar button in the registry is:
[HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Internet Explorer \ Extensions]
Each primary key under this branch represents a self-made toolbar button. For example:
{CD67F990-D8E9-11d2-98FE-00C0F0318AFE} represents: RealPlayer
{57E91B47-F40A-11D1-B792-444553540000} indicates NetAnts
We can create a {00000000-0000-0000-0000-000000000001--} by ourselves (note that this key value must be unique, or other toolbar buttons may be damaged ).
Under each primary key, there are usually the following key values (both string-type ):
ButtonText: The text displayed on the Custom button.
CLSID: the class ID code of the IE Toolbar. It is always "{1fba04ee-3024-11d2-8f1f-440f87abd16 }".
Default Visible: controls whether the Custom button is Visible. Generally, the value is "Yes ".
Exec: the target of the Custom button execution, which can be the execution program or hypertext link.
HotIcon: the icon displayed when you move the cursor over the button.
Icon: the Icon displayed normally.
MenuText: the menu items displayed in IE's "Tools" menu.
MenuStatusBar: "comment" text displayed on the status bar.
Now that you know the necessary knowledge, you can use VBScript to create IE Toolbar buttons. Next I will add the "my computer" button as an example, to demonstrate how to use VBScript to implement self-made IE Toolbar buttons.
AddButton. vbs (Save the following code as the AddButton. vbs file)
'Define an object that can communicate with the operating system
Dim WSHShell
Set WSHShell = WScript. CreateObject ("WScript. Shell ")
'Define various button-related parameters
KeyName_11 = "ButtonText"
KeyData_12 = "my computer"
KeyName_21 = "CLSID"
KeyData_22 = "{1fba04ee-3024-11d2-8f1f-440f87abd16 }"
KeyName_31 = "Default Visible"
KeyData_32 = "Yes"
KeyName_41 = "Exec"
KeyData_42 = "C: \ Windows \ assumer.exe"
KeyName_51 = "HotIcon"
'Borrow the RealPlayer icon
KeyData_52 = "C: \ Program Files \ Real \ RealPlayer \ eb_act.ico"
KeyName_61 = "Icon"
'Borrow the RealPlayer icon
KeyData_62 = "C: \ Program Files \ Real \ RealPlayer \ eb_inact.ico"
KeyName_71 = "MenuText"
KeyData_72 = "my computer"
KeyName_81 = "MenuStatusBar"
KeyData_82 = "open my computer"
'Define parameters related to registry operations
RegPath = "HKEY_LOCAL_MACHINE \ Software \ Microsoft \ Internet Explorer \ Extensions \ {00000000-0000-0000-0000-000000000001 }\"
DataType = "REG_SZ"
'Defines a function to add parameters to the Registry.
Function ValueAdd (KeyName, KeyData)
WSHShell. RegWrite RegPath & KeyName, KeyData, DataType
End Function
'Call the Add () process to Add parameters to the Registry.
Call ValueAdd (KeyName_11, KeyData_12)
Call ValueAdd (KeyName_21, KeyData_22)
Call ValueAdd (KeyName_31, KeyData_32)
Call ValueAdd (KeyName_41, KeyData_42)
Call ValueAdd (KeyName_51, KeyData_52)
Call ValueAdd (KeyName_61, KeyData_62)
Call ValueAdd (KeyName_71, KeyData_72)
Call ValueAdd (KeyName_81, KeyData_82)
'The "OK" message box is displayed and corresponding processing is made.
Dim confirm
Confirm = MsgBox ("the self-made button has been added. You need to restart the system to take effect. Do you want to restart it? ", 4," Please confirm! ")
If confirm = 6 Then
MsgBox ("the homemade button has been set successfully. Please restart the system! ")
Else
WScrip t. Quit ()
End If
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service