Alaska Software Inc. - Internet Explorer - how to tell if window has been closed
Username: Password:
AuthorTopic: Internet Explorer - how to tell if window has been closed
Chris Carmac Internet Explorer - how to tell if window has been closed
on Wed, 05 May 2010 01:05:57 -0400
Hello, everyone!

If I launch a new instance of Internet Explorer using the CreateObject() 
function (Example:  oIE := CreateObject("InternetExplorer.Application") 
), is there any way to tell if the user has closed the window?

I tried to check some of the properties of the IE object, such as 
"height", but when I do I get an error stating, "RPC server is 
unavailable".

Thanks!

Chris Carmac
Rodd Graham Re: Internet Explorer - how to tell if window has been closed
on Mon, 17 May 2010 05:58:32 +0000
Hello Chris,

> Hello, everyone!
> 
> If I launch a new instance of Internet Explorer using the
> CreateObject() function (Example:  oIE :=
> CreateObject("InternetExplorer.Application") ), is there any way to
> tell if the user has closed the window?
> 
> I tried to check some of the properties of the IE object, such as
> "height", but when I do I get an error stating, "RPC server is
> unavailable".
> 
> Thanks!
> 

Use the OnQuit event to be notified when the application is closed.  With 
tabbed browsing you might also need to watch for specific tab events...

You must use an event because any polling strategy will fail when the COM 
object reference dies (after the automation server close).  The event is 
your applications cue to remove all object references as they are no longer 
valid.

Regards,

Rodd Graham, Consultant
Graham Automation Systems, LLC