Determine if an application is not responding

Source: Internet
Author: User
Tags bool

Today, I saw two articles on MSN's core discussion group. The question is whether the application is unresponsive. The original text is as follows:

> How are it possible to determine a process is ' not responding ' like NT Task

> Manager do?

The heuristic works is for GUI processes, and consists of calling

SendMessageTimeout () with Smto_abortifhung.

>there are any APIs call to doing job, or this status is simply a deduction

>based on process counters, like so returned from call to Getprocesstimes

>api function?

Use SendMessageTimeout with a value of wm_null. That ' s all Task

Manager does to determine this AFAIK.

--

There is a rational reason. Of course, I also have a undocumented function here, but other solutions, NT and 9X have a USER32.DLL function, Ishungappwindow (NT) and Ishungthread (9X). It's easy to use. The following is a prototype.

BOOL Ishungappwindow (

HWND hwnd,//Handle to main app ' s window

);

BOOL Ishungthread (

DWORD dwThreadID,//The thread ' s identifier of the main app ' s window

);

With the prototype, even the explanation is not necessary, good not.:) However, the call requires GetProcAddress. The function is not in the library.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.