WebBrowser -- Displaying html and graphics that are resident in memory

  • Thread starter Thread starter David Elliott
  • Start date Start date
D

David Elliott

I have an array list that contains a HTML file and supporting graphics / css / etc.

I know that I can write the files to disk and then display them using the
AxSHDocVw.AxWebBrowser class and navigate to the files.

What I am wanting to do is...Bypass the write to the hard drive and
insert it directly into the AxSHDocVw.AxWebBrowser somehow.

I know I can do this to wirte the HTML into the control
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
doc.body.innerHTML = someHTMLTextString;
But what about the graphics.

How would I get them to display???

Thanks,
Dave
 
Hi David,

I will spend some time on this issue, and reply to you some time later.
Thanks for your understanding!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi David,

Sorry for letting you wait for so long.

First, the html file code refers and displays the images through <img src=>
element, which the src property points to an relative or absolute image
path. So if we do not want the images to be saved to disk and display, we
have to change the default parsing of WebBrowser for <img src> from a url
image to some memory image stream.

After doing a lot of research, I found that there is not an easy work to
get this done. The way I can think of to get this done is create a our own
"Pluggable Protocols" to handle the request. Also, we should modify the url
path in <img src=> to some "Pluggable Protocols" aware of protocal string.
For more information, please refer to:
"About Asynchronous Pluggable Protocols "
http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/plugg
able/overview/overview.asp
and
"Pluggable Protocols"
http://www.microsoft.com/mind/0199/cutting/cutting0199.asp

Actually, when IE visits a webpage, it also gets and saves the images on
that page as temp files and then display it. I think this should be an
easier and official way to get what you want. Can you show me your concern
not to save the images?
=======================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I am trying to avoid any disk I/O if possible. The reason for this is I am doing a lot of document
processing and could potentially fill up a hard drive if the files are not properly cleaned up. The
files would also be transient. Other issues as well. Ultimately, I am trying to bypass bureaucracy.

From what you are saying, I would be expending a lot of effort for such a small return. I guess I
will just write them to disk.

Thanks for your input.

Dave
 
Hi David£¬

Thanks very much for your feedback!

As we can see, IE also stores the images on the webpage on a temp folder.
And the temp files in the IE temp folder are very large also, so we should
simulate this and take care of the garbage files clean up. I think the
garbage file clean up code is much simple than the memory stream code and
easy to implement, but need a little extra care.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi there David

try this:
private void BrowseContent(string content)
{
object [] dataStream = {content};

((mshtml.IHTMLDocument2)this.axWebBrowser.Document).write(dataStream);
}

Tiago Miguel Silva
 
Back
Top