Article ID: 231844 - Last Review: July 1, 2004 - Revision: 3.2 How To Detect If an Application Has Stopped RespondingThis article was previously published under Q231844
For a Microsoft Microsoft Visual Basic
.NET version of this article, see 304990
(http://support.microsoft.com/kb/304990/
)
.
SUMMARY In many situations you may want to know if an application
is blocked. For example when you automate Microsoft Internet Explorer, you want
to know whether Internet Explorer stops responding. This article describes how to detect whether an automated instance of Internet Explorer stops responding. Although the code is written for Internet Explorer and Visual Basic, you can also use the following instructions for other applications. The code uses the Win32 API SendMessageTimeout function to determine whether the target application responds and then the API call TerminateProcess to kill the hung instance of Internet Explorer. MORE INFORMATION There is no clear definition of an application hanging.
Typically the application is "busy" with some processing. However from a user's
perspective, the application has stopped responding. The idea is to periodically detect if the application is still responding in a timer and depending on application logic, the target application can be killed or other necessary action can be taken. The following steps demonstrate this. The code assumes that Internet Explorer is installed on the target machine.
NOTE: None of the automation properties of Internet Explorer will be accessible once Internet Explorer stops responding, which is the reason for storing hwnd in a form level variable. REFERENCESFor additional information, click the article
numbers below to view the articles in the Microsoft Knowledge Base: 129797
(http://support.microsoft.com/kb/129797/EN-US/
)
How To Launch a Win32 Application from Visual Basic
178893
(http://support.microsoft.com/kb/178893/EN-US/
)
How To Terminate an Application Cleanly in Win32
176391
(http://support.microsoft.com/kb/176391/EN-US/
)
How To Programmatically Close a Single Instance of a Windows-Based Program
APPLIES TO
| Article Translations
|
Back to the top
