"Not Responding" appears in the title bar of the program while Task manager showing 'not responding' status. Using this fact you can detect if your program is in 'not responding' status.

Set $NOT_RESPONDING variable accordingly your application title.

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"; } }

I am not on Windows now and can't test if the script runs without errors. But I hope it will be helpful.


In reply to Re: Applications running status in Windows Task Manager (SOLUTION) by ccn
in thread Applications running status in Windows Task Manager by shan_emails

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.