Hello,
The short C# example below based on the BandObject library
(http://codeproject.com/csharp/dotnetbandobjects.asp). The key thing
I'm doing is handling the DocumentComplete event and then within this
accessing Explorer.Document. I have found that if you open a PDF file
embedded within a new browser window (not the same IE window, but a
new IE window) that, upon closing the IE window with the PDF file, IE
crashes. If I do NOT access Explorer.Document (comment out the line
below in DocumentComplete) then the crash does not occur. Any PDF
file will suffice. For example: www.macromedia.com/software/central/
whitepaper/central_wp.pdf
Steps to reproduce:
1. Build this program and regasm it
2. Start IE and make sure it is running (need to unclick and reclick
the toolbar menu option)
3. Goto http://www.macromedia.com/software/central
4. Right click on the whitepaper PDF link and click "open in new
window"
5. Now close the newly opened window and IE will crash
My questions are:
1. Why does it crash? Why can't I access Explorer.Document if a PDF
file is embedded in the window?
2. Assuming there is some reason I cannot, then what is the best way
to know NOT to access Explorer.Document? Is there a better way than
just checking the URL to see if it ends in ".pdf"?
Thank you.
Steve
----
[System.Runtime.InteropServices.Guid("4FB26B73-D6E6-4e1f-A8BE-4980D1760EAC")]
public class MyBandObject : BandObjectLib.BandObject
{
public MyBandObject()
{
this.ExplorerAttached += new
System.EventHandler(this.ExplorerAttachedHandler);
}
private void ExplorerAttachedHandler(object o, System.EventArgs e)
{
this.Explorer.DocumentComplete += new
SHDocVw.DWebBrowserEvents2_DocumentCompleteEventHandler(this.WebBrowser_DocumentComplete);
}
private void WebBrowser_DocumentComplete(object pDisp, ref object
theUrl)
{
if (this.Explorer != null && this.Explorer.ReadyState ==
SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE)
{
object o = this.Explorer.Document;
}
}
}
Steve - 04 Nov 2003 18:14 GMT
Wanted to let people know that my question was answered on the IE
control newsgroup.
http://groups.google.com/groups?dq=&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&selm=%2
3PSs%24CuoDHA.2404%40TK2MSFTNGP12.phx.gbl
> Hello,
>
[quoted text clipped - 55 lines]
> }
> }