Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
233 views
in Technique[技术] by (71.8m points)

c++ - Busy Application leads to false "Not responding" state on Windows 7 - WM_UPDATE

During long term operations our C++ Win32 application shows a modal status dialog with a process bar, which is updated irregular every few seconds or so. Starting with Windows 7 we realized that Windows quite soon shows a message " seems to hang..." and/or appends "Not responding" to our window title bar.

We figured out that the process dialog must handle messages to avoid this. More specifically it seems that Windows 7 is constantly sending WM_UPDATE messages to check if our program is alive. We formerly had disabled all unneeded message handling in this dialog as profile runs shows that they were a major slow down.

But although we thought to have fixed that problem users are reporting such problems again: Windows shows " seems to hang..." and/or appends "Not responding" to our window title bar, although we handle all events every few seconds.

Questions:

  • Is there any documentation about this change of behavior in Windows 7 (or Windows vista)? We haven't found any. We also found a number of other changes of messaging behavior.

  • Is there possibly a way to disable all such "is alive" checks from windows? Our Application is pretty well alive and processes can take quite long.

EDIT: To be more specific - what we only do each few seconds is calling the message pump PeekMessage/TranslateMessage/DispatchMessage.

As this is a quite old legacy program, using a separate worker thread is not possible in the near future. We of course do that for new code. Please note also that my main point is that this behavior definitely changed with Windows vista / Windows 7. I have not found any documentation thereabout.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Well, the direct answer to your question is that you can call DisableProcessWindowsGhosting().

However, it would be much better to address the root of the problem rather than suppress the symptoms. Your window is being ghosted because you aren't pumping the message queue. You aren't doing that for the admirable reason that your application is busy doing work. The accepted way to do work and keep your queue pumped, is to do the work in a separate thread.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...