Welcome to MSDN Blogs Sign in | Join | Help

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

 

Published Tuesday, November 01, 2005 5:21 PM by Calvin_Hsia
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

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

Wednesday, November 02, 2005 9:17 AM by Kenneth Tamayo
Calvin,

This is very interesting...

On a related-note, I'd like to mention that it is VERY RARE for VFP 9.0 to be reported as "NOT RESPONDING". I can't say enough good things about this release of Visual FoxPro.

Thanks for this always interesting blog and for the intellectual/technical resources dedicated to making the BEST database.

Regards from San Juan, Puerto Rico - USA.

# What API calls reset GetLastError between Declare DLL calls in VFP8?

Wednesday, May 03, 2006 2:32 PM by Calvin Hsia's WebLog
I received a comment on this post: Will GetLastError ever work properly in VFP8.0?.  I was consistently...

# Why Do ToolTips Appear in Task Manager?

Wednesday, August 09, 2006 3:07 PM by Calvin Hsia's WebLog
I was asked why Tooltips appear in Task Manager. I happened to be out of the country when the question...

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

Friday, March 16, 2007 3:01 AM by ...

um... buoni, realmente buoni luogo e molto utile;)

# Customer site visit: 3-D printer company

Sunday, November 11, 2007 12:03 AM by Calvin Hsia's WebLog

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

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker