I am completely new to Windows. I setup an automation framework on a windows XP box. The browsers brought up by the automation process at times hang and there is no way to recover except killing the browser window. What is a good programmatic solution to this, or a DOS script that can be used to accomplish the same?

Thanks

link|improve this question
Not sure about that, but on a side note, apparently google chrome tabs are implemented as separate processes (not threads). See dev.chromium.org/developers/design-documents/… – Matt Oct 19 '10 at 21:31
feedback

2 Answers

It wouldn't be easy to script. But you can get the window handle using GetWindow and then call the function IsHungAppWindow. It would be an easy program to write in c# or vb.net

link|improve this answer
feedback

Try monitoring the browser thread state using VBScript. Here's an example directly from MSDN:

Set objDictionary = CreateObject("Scripting.Dictionary")
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process")
For Each objProcess in colProcesses
objDictionary.Add objProcess.ProcessID, objProcess.Name
Next
Set colThreads = objWMIService.ExecQuery("SELECT * FROM Win32_Thread")
For Each objThread in colThreads
intProcessID = CInt(objThread.ProcessHandle)
strProcessName = objDictionary.Item(intProcessID)
Wscript.Echo strProcessName & VbTab & objThread.ProcessHandle & VbTab & objThread.Handle & VbTab & objThread.ThreadState
Next

link|improve this answer
Thanks. Will try this and let you know! – Sands Oct 21 '10 at 13:30
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.