Add the vbs code in the right-click menu of "copy image address" in IE

Source: Internet
Author: User

However, no shortcut menu for copying image link addresses is available in IE, myie, sogou, and other browsers that share the right-click menu with IE. Generally, only the image attributes are selected and then the image address is copied in the Properties dialog box, very troublesome!
Next we will add a shortcut menu for "copy image address" to IE, as shown in the following steps:
Create an ActiveX dll project in VB. Project name: netcopyurl. Change the default generated class name to clscopyurl.
Add the following to clscopyurl. CLS: Code :
Public sub copyimageurl (URL as string)
Clipboard. Clear
Clipboard. settext URL
End sub
Run file-> make netcopyurl. DLL to generate the dynamic link library file netcopyurl. dll.
Copy netcopyurl. DLL to the c: \ windows \ system32 folder.
Start running-> All Program -> Attachment-> command prompt, enter the following command to register dll: regsvr32 c: \ windows \ system32 \ netcopyurl. dll
Open notepad, input the following content, and store it in c: \ Program Files \ copyimageurl \ copyurl.htm. This is the VBScript to be executed in the right-click menu. Copy code The Code is as follows: <script language = "VBScript">
Sub oncontextmenu ()
On Error resume next
Set srcevent = External. menuarguments. Event
Set eventelement = external.menuarguments.doc ument. elementfrompoint (srcevent. clientx, srcevent. clienty)
Set objnet = Createobject ("netcopyurl. clscopyurl ")
Objnet. copyimageurl (eventelement. href)
End sub
Call oncontextmenu ()
</SCRIPT>

finally, right-click ie in the Registry and choose create a reg file, such as addmenu, at any location. reg, enter the following content: copy Code the code is as follows: windows Registry Editor Version 5.00
[HKEY_CURRENT_USER \ Software \ Microsoft \ Internet Explorer \ menuext \ Copy image address (& X)]
@= "C: \ Program Files \ copyimageurl \ copyurl.htm "
" contexts "= DWORD: 0000002

after saving the file, double-click the addmenu. reg file to import the registry key. The right-click menu is added.
the contexts value written to the Registry in step 1 indicates that the context menu appears when you right-click an object in IE. The specific meanings are as follows (can be combined ):
0x01 default
0x02 Image
0x04 Control
0x08 form field
0x10 select text
0x20 hyperlink
example:
contexts = 0x000002 indicates that the shortcut menu is displayed when you right-click an image in IE.
contexts = 0x000022, indicates that when you right-click an image or hyperlink in IE, the set right-click menu appears
OK. Open ie again, open a webpage with images, right-click the image, in this case, the "copy image address (& X)" menu item appears. Select this menu command to copy the image link address.
change the content of copyurl.htm to the following code. The first five steps can be omitted. (No ActiveX dll is required)

creates an installation file. Download and decompress the file, right-click copyimageurl. inf, and select "Install. Open a webpage with images, right-click the image, and the "copy image address (& X)" menu appears. Select this menu command, the link address of the image is copied. Installation File:
copyimageurl.zip

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.