if IE is running

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.
 
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.

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.
 
R

rowe_newsgroups

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
 
G

Guest

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
 
M

Michel Posseth [MCP]

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
 

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