AxWebBrowser show image

R

RedLars

The application in question uses .NET 1.1 (cannot use 2.0 atm). An
html page is dynamically generate within the application and is
displayed using AxSHDocVw.AxWebBrowser.

The problem with this solution is that the web page displayed inside
AxSHDocVw.AxWebBrowser UI component doesn't show images referered to
in the html page, it only shows an empty box. Tried using Process
Monitor to see what path's that the application tired to use but no
luck. Saving the html to file is not an option atm. Tried saving the
image in question in application folder, also tried setting src="c:
\logo.ico" without any luck.

Here is a small code;

object empty = System.Reflection.Missing.Value;
axWebBrowser1.Navigate("about:blank", ref empty, ref empty, ref empty,
ref empty);

string strHTML= "<html><head><META http-equiv=\"Content-Type\" content=
\"text/html; charset=utf-8\"><title>System Report</title></
head><body><img class=\"logo\" alt=\"logo\" src=\"logo.ico\"><h1>TEST</
h1></body></html>";

mshtml.IHTMLDocument2 BrowserDoc = axWebBrowser1.Document as
mshtml.IHTMLDocument2;
BrowserDoc.clear();
BrowserDoc.write(strHTML);
BrowserDoc.close();

Appreciate any input.
 
R

RedLars

The application in question uses .NET 1.1 (cannot use 2.0 atm). An
html page is dynamically generate within the application and is
displayed using AxSHDocVw.AxWebBrowser.

The problem with this solution is that the web page displayed inside
AxSHDocVw.AxWebBrowser UI component doesn't show images referered to
in the html page, it only shows an empty box. Tried using Process
Monitor to see what path's that the application tired to use but no
luck. Saving the html to file is not an option atm. Tried saving the
image in question in application folder, also tried setting src="c:
\logo.ico" without any luck.

Here is a small code;

object empty = System.Reflection.Missing.Value;
axWebBrowser1.Navigate("about:blank", ref empty, ref empty, ref empty,
ref empty);

string strHTML= "<html><head><META http-equiv=\"Content-Type\" content=
\"text/html; charset=utf-8\"><title>System Report</title></
head><body><img class=\"logo\" alt=\"logo\" src=\"logo.ico\"><h1>TEST</
h1></body></html>";

mshtml.IHTMLDocument2 BrowserDoc = axWebBrowser1.Document as
mshtml.IHTMLDocument2;
BrowserDoc.clear();
BrowserDoc.write(strHTML);
BrowserDoc.close();

Appreciate any input.

Thought I'd give this another go.

Using axWebBrowser1.Navigate("www.google.com" ....) or
axWebBrowser1.Navigate("C:\mywebpage.htm"...) both are able to show
webpages with images.

The problem seems to be when using IHTMLDocument2.write method the
images specified are not shown. Tried setting src to both absolute and
relative compare to the application but no luck. Not been able to
locate any sort of property that sets the search-path or base-path for
this component to use when looking for resources such as an image.

Any suggestions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top