Shell.Application.Windows() -- What if a window is hanging?

  • Thread starter Thread starter Adrian
  • Start date Start date
A

Adrian

Hi there

My VB Code looks something like that:

**************************************************************
Dim oShellApplication = CreateObject("Shell.Application")
Dim objWindow
For Each objWindow In oShellApplication.Windows()
'do stupid things with IE
Next objWindow
**************************************************************

The most of time, this works fine, but if some of the Window is hanging
(gives no response), the script goes hold on, until all window gives a
response. What can i do, to jump over a hanging window?

thanx a lot!

greets adi
 
Adrian,

I would not know and probably most of us don't we use the Process command
for this.

///Internet Explorere
Dim p As New Process
Dim pi As New ProcessStartInfo
pi.FileName = "http://msdn.microsoft.com"
p.StartInfo = pi
p.Start()

I hope this helps,

Cor
 
Hi Cor

You describe what is todo, to start a new Process. But i would like to
go through all open process (internet explorer windows) and find a
specific one. You know what i mean?

Thank u!
 
Hi there

My VB Code looks something like that:

**************************************************************
Dim oShellApplication = CreateObject("Shell.Application")
Dim objWindow
For Each objWindow In oShellApplication.Windows()
'do stupid things with IE
Next objWindow
**************************************************************

The most of time, this works fine, but if some of the Window is hanging
(gives no response), the script goes hold on, until all window gives a
response. What can i do, to jump over a hanging window?

thanx a lot!

greets adi

I believe you could use the SendMessageTimeout API call to see if a
window is hung (it has a flag that aborts the call if the window is
hung as well as a timeout), so perhaps you could it to check if a
window is hung before trying to "do stupid things"

Here's the pinvoke.net pages:

http://www.pinvoke.net/default.aspx/user32/SendMessageTimeout.html
http://www.pinvoke.net/default.aspx/Enums/SendMessageTimeoutFlags.html

Thanks,

Seth Rowe
 
One last question...
Could u write some sample code for me please?
I've no idea how to use this api...

sorry & thanx
 
Back
Top