use strict; use warnings; use Win32::API; my $NOT_RESPONDING = 'Your App (Not Responding)'; use constant GW_CHILD => 5; use constant GW_HWNDNEXT => 2; Win32::API->Import('user32', 'HWND GetDesktopWindow()'); Win32::API->Import('user32', 'HWND GetWindow(HWND hWnd, UINT uCmd)'); Win32::API->Import('user32', 'GetWindowText', 'LPi', 'i'); my $hwnd = GetDesktopWindow(); $hwnd = GetWindow($hwnd, GW_CHILD); while ($hwnd) { $hwnd = GetWindow($hwnd, GW_HWNDNEXT); my $title = 'x' x 256; GetWindowText($hwnd, $title, length($title) - 1); if ($title =~ /\Q$NOT_RESPONDING/) { print "Detected: $NOT_RESPONDING\n"; } }