DWM and drawing non-responsive applications

In Vista and later versions, if the application stops responding, the window manager of the desktop can handle redrawing it when necessary (move the window on top of it, drag it, etc.), because the pixel buffer is saved for it. Windows is also trying to determine when the application stops responding after some time-out, and trying to get the most out of the situation - I believe that it darkens the window, adds “Not Responding” to the title bar, and possibly some other effects.

Now we have a skinned application that uses window areas and layered windows, and it’s not very good with these effects. We developed on XP, but noticed a strange effect when testing on Vista. At some points, the application may spend several minutes on some calculations or a callback, and "if the message has not been received within 5 seconds, DWM declares the window to hang" ( MSDN - Preventing Hangs in Windows Applications ). It seems that when this happens, a strange graphical problem arises: any pixels that are 100% transparent due to areas of the window turn black, which actually makes the window rectangular again with a black background. There seem to be other anomalies when the pixels of the original window are slightly offset in some child dialogs.

I am working to reduce such delays (ideally, Windows will never need to intervene like this), and try to maintain responsiveness while it is busy, but I still would like to find out what causes it to render as much as I can. I can’t guarantee I can fix all the delays.

Essentially, I just wanted to know what Windows does when this happens, and how I can get my application to work correctly with it. Skin apps should still work in Vista and later, so I need to find out what I'm doing, which is non-standard. I don’t even know exactly how to look for information about how Windows now processes applications that do not respond to requests, since my searches return only people who have problems with applications that do not respond, or very elementary explanations of what DWM does with such applications. Gosh, I'm not even 100% sure that this is a responsible DWM, but that seems likely. Are there any potential leads?

; ( , - , () ):

Unresponsive app

+3
3

, "ghosting", , XP ( , DWM , ). DisableProcessWindowsGhosting(). , , , , , . , , ; , , , .

ghosting Vista/7, , , , , , , .

0

; Office 2007/2010, .

0

I think there are basically two things that will help with this:

First, like you, try not to hang in the first place: do as little hard work as possible in the user interface threads as possible.

Secondly, do not use multiple top-level windows to implement what the user must understand as one; instead, make the composition yourself. This will prevent layers from moving due to synchronization with each other.

0
source

Source: https://habr.com/ru/post/1737552/


All Articles