Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Elliott - 01 Nov 2004 18:59 GMT
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
"Jeffrey Tan[MSFT]" - 02 Nov 2004 10:27 GMT
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
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

"Jeffrey Tan[MSFT]" - 04 Nov 2004 02:53 GMT
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
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

David Elliott - 04 Nov 2004 13:47 GMT
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,
>
[quoted text clipped - 32 lines]
>Get Secure! - www.microsoft.com/security
>This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 05 Nov 2004 03:13 GMT
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
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Tiago Miguel Silva - 24 Dec 2004 11:03 GMT
Hi there David

try this:
       private void BrowseContent(string content)
       {
           object [] dataStream = {content};
           
((mshtml.IHTMLDocument2)this.axWebBrowser.Document).write(dataStream);
       }

Tiago Miguel Silva

> I have an array list that contains a HTML file and supporting graphics / css / etc.
>
[quoted text clipped - 13 lines]
> Thanks,
> Dave

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.