Udostępnij za pośrednictwem


How does Task Manager determine if an Application is Not Responding?

If you start Task Manager (Ctrl-Shift-Esc) and display the Applications tab, you will see a list of running applications. Once in a while an application shows as “Not Responding”.

How does Task Manager figure that out?

A simple way to determine the answer is to start Notepad and SPY++ (see Spy on your programs). Watch the messages that get sent to Notepad. You’ll see that the WM_GETICON message is sent to notepad when Task Manager starts up.

Task Manager tests to see if a SendMessage of WM_GETICON to the main application window returns. If not, it displays “Not Responding”. That doesn’t mean, however, that the process is dead.

VFP has a property called _VFP.AutoYield which determines whether pending Windows messages will be processed during program execution.

You can test to see if the UI thread and the processing thread are the same in VFP by executing this code and starting Task Manager

_vfp.AutoYield=.f.

FOR i = 1 TO 100000000

      xx="test string"

ENDFOR

For more about Autoyield: see Interesting form paint behavior

Comments

  • Anonymous
    November 02, 2005
    The comment has been removed

  • Anonymous
    May 03, 2006
    I received a comment on this post: Will GetLastError ever work properly in VFP8.0?.  I was consistently...

  • Anonymous
    August 09, 2006
    The comment has been removed

  • Anonymous
    March 15, 2007
    um... buoni, realmente buoni luogo e molto utile;)

  • Anonymous
    November 10, 2007
    I spent a few hours at a local company called 2Bot ( http://www.2bot.com/ ) which makes a 3-D printer