Hab ich mal irgendwo ausgeschnipselt, aber nie benutzt:
Delphi-Quellcode:
// For Win NT/2000/XP
function IsAppRespondigNT(wnd: HWND): Boolean;
type
TIsHungAppWindow =
function(wnd:hWnd): BOOL;
stdcall;
var
hKernel: THandle;
IsHungAppWindow: TIsHungAppWindow;
begin
Result := True;
hKernel := GetModuleHandle('
user32.dll');
if (hKernel > 0)
then
begin
@IsHungAppWindow := GetProcAddress(hKernel, '
IsHungAppWindow');
if Assigned(IsHungAppWindow)
then
begin
Result :=
not IsHungAppWindow(wnd);
end;
end;
end;
function IsAppRespondig(Wnd: HWND): Boolean;
begin
if not IsWindow(Wnd)
then
begin
ShowMessage('
Incorrect window handle');
Exit;
end;
if Win32Platform = VER_PLATFORM_WIN32_NT
then
Result := IsAppRespondigNT(wnd)
else
Result := IsAppRespondigNT(GetWindowThreadProcessId(wnd,
nil));
end;