Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2003

Tip: Looking for answers? Try searching our database.

IE crashes with BandObject and PDF

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve - 04 Nov 2003 02:24 GMT
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]
>     }
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.