Detecting window.close in WebBrowser control

T

Tuong

I have a situation where i have a form that contains a
webbrowser control. With this I was able to implement an
application that can browse websites. One particular
website i visited opens up another web page in a new
window and then closes it. I was able to control this
action by detecting the 'NewWindow' event and opening the
webpage in my own application.

Now the problem i have come across is that when the
webpage that was opened in a new window exits (i think it
is the result of a scripted 'window.close') the
webbrowser control that was displaying the webpage closes
and i am left with an empty form.

What I would like to do is detect the webbrowser control
closing and close the form it is contained in. The
WebBrowser control ignores the 'Quit' and 'OnQuit' events
which i thought could have been used to do this. The only
event i have been able to detect is the 'WindowClosing'
event, though this fires before the webbrowser control
actually closes. Has anyone come across this problem or
am i not using the webbrowser control properly? I would
greatly appreciate any feedback.
 

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