IHTMLDocument2, HTMLImgClass and images

  • Thread starter Thread starter Chris Soulsby
  • Start date Start date
C

Chris Soulsby

Hi,

I've wrote a AxWebBrowser control to display html interfaces in my
application. This works fine, however, I would like to load images from my
application's resources instead of saving them to file then referencing that
file. For example:

in the HTML i'd have a image like this <img src="test.jpg" id="test"> and
then

mshtml.IHTMLDocument2 oIHTMLDocument2 = this.m_oHtmlBrowserControl.Document;
for(int x = 0; x < oIHTMLDocument2.images.length; x++)
{
mshtml.HTMLImgClass o =
(mshtml.HTMLImgClass)oIHTMLDocument2.images.item(x,0);
if(o.id == "test")
{
// *********** load image from resources **********************
}
}

Has anyone done anything like this before? Can you help?

Thanks for any help

Chris
 
Chris,

If you want to use the older resource mechanism, you can use the res
protocol which is an asychronous pluggable protocol that allows you to load
content from resource files. An article on MSDN titled "res Protocol" will
help, and it is located at (watch for line wrap):

http://msdn.microsoft.com/library/default.asp?url=/workshop/networking/predefined/res.asp

Be aware that you might have problems if the user is running IE6 SP1.

Also, if you want to use .NET resources, you can always define your own
asynchronous pluggable protocol which will read the resource and stream it
to the COM subsystem (which then turns it over to IE).

Hope this helps.
 
Back
Top