Show local pictures in Internetexplorer.application

Source: Internet
Author: User
Tags microsoft website

Forget, like a person's feeling

Demon ' s Blog?  Programming? Show local pictures in Internetexplorer.application

? Reconsideration on the efficiency of VBS--processing binary data wordpress to determine if the user is logged in? show local images in Internetexplorer.application

Tags: img, internetexplorer.application, VBS, VBScript, pictures

Title: Displaying local pictures in internetexplorer.application
Author: Demon
Links: http://demon.tw/programming/internetexplorer-application-img-src.html
Copyright: All articles of this blog are subject to the terms "Attribution-NonCommercial use-share 2.5 mainland China" in the same way.

A long time ago the problem, has not been solved, today accidentally searched the answer.

It is not a problem to display a picture on a remote server in a Internetexplorer.application object:

Dim Ieset ie = CreateObject ("Internetexplorer.application") ie. Navigate "About:blank" IE. document.write " 
  

However, in the default settings of IE, the local image cannot be displayed:

Dim Ieset ie = CreateObject ("Internetexplorer.application") ie. Navigate "About:blank" IE. document.write " 
  

Some people say that to use a relative path, someone says the path is to use a backslash

Fea document.write " 
  

Some say they want to add a protocol name.

Fea document.write " 
  

Others say add a protocol name and use a backslash

Fea document.write " 
  

I have tried, no use, baffled.

Today, but inadvertently search the code on a Microsoft website, finally enlightened:

Option Explicitdim objWSHShell, objFSO, strVariableName, objexplorer, strscriptfiledirectoryset ObjWshShell = WScript.CreateObject ("Wscript.Shell") Set objFSO = CreateObject ("Scripting.FileSystemObject") StrVariableName = " Whateveryouwant "strscriptfiledirectory = Objfso.getparentfoldername (wscript. ScriptFullName) ' Displays the Internet Explorer Informational message window. Displayiewindowwscript.sleep 4000closeiewindowwscript.quit ' ~$~----------------------------------------~$~ ' fun Ctions & subroutines ' ~$~----------------------------------------~$~sub Displayiewindow ' executes an Internet Explorer window. Dim Strieregistrykey, Strcheckassociationskeystrieregistrykey = "Notexist" on Error Resume Next ' the following registry en Try would enable local files such as.  GIFs to being displayed using IE 7.0, but this setting won't take effect if the Web browser is already open (there would be No error messages displayed if this are the case). Strieregistrykey = Objwshshell.regread ("HKCU\software\microsoft\windows\currentversion\internet settings\zonemap\domains\blank\about ") WScript.Echo Strieregistrykeyif Strieregistrykey = "Notexist" then Objwshshell.regwrite "hkcu\software\microsoft\windows\ CurrentVersion\Internet Settings\zonemap\domains\blank\about ", 2," REG_DWORD "WScript.Echo" Escreve "End If ' Attempts To temporarily prevent Internet Explorer checking to see if it's the default browser (storing the existing value to be re Stored after disaplying the script ' s IE window. Strcheckassociationskey = Objwshshell.regread ("Hkcu\software\microsoft \internet explorer\main\check_associations ") objwshshell.regwrite" HKCU\Software\Microsoft\Internet Explorer\Main\ Check_associations "," No "," REG_SZ "Set Objexplorer = CreateObject (" Internetexplorer.application ") Objexplorer.navigate "About:blank" Objexplorer.toolbar = 0objexplorer.statusbar = 0objexplorer.left = 200objexplorer.top = 100objexplorer.width = 450objexplorer.height = 220objexplorer.visible = 1objExplorer.Document.BoDy. Scroll = "no" objExplorer.Document.Body.Style.Cursor = "Wait" objExplorer.Document.Title = "window Title Name Goes here" &A mp String (50, ".") ObjExplorer.Document.Body.InnerHTML = " ' & ' <b><font size= ' 4 ' ><font color= ' #008000 ' > ' & strVariableName & ' ... </ Font></b><br>this application is currently being installed, and could take up to 5 minutes to Complete.<p align= ' center ' ><font size= ' 3 ' ><b>installation Start time:</b> "& Time &" </p></ P><p align= ' center ' ><font size= ' 2 ' >*closing this window would <u>not</u> abort the Installation<font color= ' #808080 ><br> (this window would close automatically after the process completes) </font></font> "' attempts to make the Open IE window active. Wscript.Sleep 1000objwshshell.appactivate "window Title Name Goes here" Wscript.Sleep1001 ' Removes the added registry key setting used with IE 7.0 if it does not already exist. If Strieregistrykey = "Notexist" then Objwshshell.regdelete "hkcu\software\microsoft\windows\currentversion\internet Settings\zonemap\domains\blank\ "End If ' restores the original Check_associations registry setting from the script ' s store D value.objWshShell.RegWrite "HKCU\Software\Microsoft\Internet explorer\main\check_associations", Strcheckassociationskey, "REG_SZ" End Sub ' ~$~----------------------------------------~$~sub Closeiewindow ' attemps To close the Internet Explorer window if it is opened by this script. On Error Resume nextobjexplorer.quitend Sub

The comments in the code are written in detail and I won't explain them. What the? Can't read English? Then you click the Reference link to see the original, the outside of the code is Portuguese, the author does not use Portugal to write comments is very good.

After the problem with the picture is resolved, VBS can also write a nice web interface.

Reference Links: Script internetexplorer.application + img SCR

Related articles:

    1. How to change IE View Source file default program
    2. Using the correct version of XMLHTTP
    3. VBS implements "multithreading"
    4. The difference between run and exec in VBS
    5. VBS calls Windows API functions

Random article:

    1. Using WMI to create the perfect "three-no" back door-the end
    2. Implementing PHP's Base64_encode function with C language
    3. VBS implements UNICODE (UTF-16) to UTF-8
    4. NETGEAR WNDRMAC Router Brush openwrt
    5. Windows 7 Quick Share Internet wireless network

This post was posted on February 19, 2011, Saturday, 00:36

Show local pictures in Internetexplorer.application

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.