Re: CDHtmlDialog fail to load image in Vista



"John Tan" <JohnTan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:4D4A62B3-A2DB-43A6-B526-866CC5AF8AD3@xxxxxxxxxxxxxxxx
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





.



Relevant Pages

  • Re: CDHtmlDialog fail to load image in Vista
    ... If I take the same HTML file and display it with: ... is coming from the resource, and it is referencing an external .gif file, ... Or else do what I did and load the HTML file and the image ...
    (microsoft.public.vc.mfc)
  • Re: Deny access to a directory with web.config
    ... Good suggestion, but is there a way to control access to that ... >> and getting the image (or the html file, ... >> obly the webapplication to be able to load and display the files ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: forcing ie to save the contents of the html instead of displaying it
    ... >I have an html file where I display name,address,zip. ... I know I can set it up as a txt file and let them download it ... to do this if *they* want it to without any special work on your part? ...
    (comp.infosystems.www.authoring.html)
  • Re: Calling scripts
    ... use multiple times or later on in your script. ... So what I'm hearing here, I think, is a suggestion to, in this case for ... some cases the file is an html file ... a separate html file. ...
    (alt.php)
  • Re: How to add a small HTML table under a row of a GridView
    ... row below it and in that row I add a label from code. ... HTML file i bind from the resource so it will display some data ... already tried to use DetailView which works since it contains binding ...
    (microsoft.public.dotnet.framework.aspnet)