Mega Code Archive

 
Categories / Delphi / Hardware
 

How to detect a program that Not Responding

Title: How to detect a program that Not Responding? Question: Detecting not responding Answer: function IsHung(theWindow: Hwnd; timeOut: LongInt): Boolean; var dwResult: DWord; begin Result:= SendMessageTimeOut(theWindow, WM_NULL, 0, 0 , SMTO_ABORTIFHUNG or SMTO_BLOCK, timeOut, dwResult) 0; end; you can use FindWindow() function to get Handle of Window. timOut is in Miliseconds.