Images and InnerHTML

cristd

Newcomer
Joined
Nov 13, 2003
Messages
2
Location
Ramstein, Germany
I'm in way over my head and hope someone can help.

I'm creating an InternetExplorer.Application and pushing HTML into the document.body.innerHTML to display. The problem is that I've run into a situation where I need to display an image in the innerHTML. I've tried saving the image to the local drive and putting an <IMG> pointing to the application directory to display it, but no joy. Anyone know how to get an image into the innerHTML? Here's a code snipet to give an idea of what I'm up to. strPrint is just HTML text.

'Call IE to display the document for printing or email
oIE = CreateObject("InternetExplorer.Application")
oIE.Navigate("about:blank", True)
oIE.Height = 600
oIE.width = 800
oIE.Top = Me.Top
oIE.Left = Me.Left
oIE.StatusBar = False
oIE.AddressBar = False
oIE.MenuBar = True
oIE.document.body.innerHTML = strPrint
oIE.Visible = True
 
I figured it out. I was using the wrong url for the file. Here's the code:

If File.Exists("temp.jpg") Then
Kill("temp.jpg")
End If

Dim fs As New FileStream("temp.jpg", FileMode.CreateNew)
' Create the writer for data.
Dim w As New BinaryWriter(fs)
' Write data to Test.data.
w.Write(bytBLOBData)
w.Close()
fs.Close()
strPrint += "<IMG src=""" + Application.StartupPath + "\temp.jpg"">"
 
Back
Top