such a comprehensive explanation. Yup, I chose to load all externally and it
now works. Also, a special thanks for even telling me to navigate in absolute
path, rather than relative path as I would certainly make this mistake.
"John Tan" <JohnTan@discussions.microsoft.com> wrote in message
news:4D4A62B3-A2DB-43A6-B526-866CC5AF8AD3@microsoft.com...
Hi David,
Thanks for suggestion. I have tried all ways which I could think of,
including the ones you suggested:
<IMG src="file://banner.gif">
<IMG src="banner.gif">
<IMG src="file:///./banner.gif">
<IMG src="file:.\banner.gif">
<IMG src="file:<absolute path>banner.gif"
None of the above worked.
Under XP, below works:
<IMG src="file:banner.gif">
<IMG src="file:.\banner.gif">
and the rest which I tried above don't.
Hi John, I verified that on Vista, <IMG src="banner.gif"> does not work.
But this is assuming that this tag is in the default HTML page that is being
displayed in the DHTMLDialog as the one compiled into the .exe as a
resource. If I take the same HTML file and display it with:
BOOL CDHtmlImageDlg::OnInitDialog()
{
CDHtmlDialog::OnInitDialog();
...
// display HTML file by specifying full file path, and don't use the
default one
Navigate (_T("e:\\src\\dcsd\\dhtmlimage\\debug\\DHtmlImage.htm"));
return TRUE; // return TRUE unless you set the focus to a control
}
then the banner.gif is shown properly.
So I think what is happening is that the HTML page you are trying to display
is coming from the resource, and it is referencing an external .gif file,
but with IE7 protected mode on Vista, this crosses "domains" and is
disallowed for security reasons. You can verify it by keeping the HTML file
as a resource, but changing the tag to be something like:
<IMG alt="" src="res:\#2/#1">
where the image to display is the first one in the .rc file. See
http://www.codeproject.com/dotnet/dhtmldialog.asp?df=100&forumid=2135&exp=0&fr=26&select=274857#xx274857xx
for a little comment on how the image specification works. I'm not sure how
exactly the res: protocol works.
That way both the HTML file and the image are in the same domain (i.e. the
resources). Or else do what I did and load the HTML file and the image
externally as files, so they are still in the same domain.
Cheers,
David