if IE is running

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way, with either VB 2005 express or vb 2008 express, to tell if IE
is running and to be able to close it from with my application. I already
know how to start IE, what I want is to be able to to detect if IE is running
and to be able to close or open IE as needed.
I do not want to kill the IE process, just to be able to close it.
 
Is there a way, with either VB 2005 express or vb 2008 express, to
tell if IE is running and to be able to close it from with my
application. I already know how to start IE, what I want is to be able
to to detect if IE is running and to be able to close or open IE as
needed. I do not want to kill the IE process, just to be able to close
it.

Using the IE API you can loop through all the windows:

Dim _IEWindows As SHDocVw.ShellWindows = New SHDocVw.ShellWindowsClass

For Each IE As SHDocVw.InternetExplorer In _IEWindows
'Do something here
Next

You need to reference ShDocVw which is the Internet Explorer COM object.
 
Using the IE API you can loop through all the windows:

Dim _IEWindows As SHDocVw.ShellWindows = New SHDocVw.ShellWindowsClass

For Each IE As SHDocVw.InternetExplorer In _IEWindows
'Do something here
Next

You need to reference ShDocVw which is the Internet Explorer COM object.

Or using the Window's API you could use the FindWindow method and grab
the internet explorer windows from there. Though I like the use of the
IE API approach much better.

Thanks,

Seth Rowe
 
Thanks
I am in the process of trying your suggestion. So far when I run the
application, I am getting 2 system - collect showing up in a listbox when no
IE window is open and 3 with 1 window open and so on. Also, I need to work on
getting the friendly name for IE and how to actually close the open window(s)
Thanks again
 
it might be simpler to use the process class

just loop through all the running processes and kill the process if it is a
IE instance
 
Back
Top