If a top-level window stops responding to messages for more than several seconds, the system considers the window to be not responding. There is an SDK Windows function IsHungAppWindow that can be used.Īn application is considered to be not responding if it is not waiting for input, is not in startup processing, and has not called PeekMessage within the internal timeout period of 5 seconds.
Without the source code to Windows we cannot be sure what it is doing internally. How does Windows know if a program is not responding? To avoid that applications should push expensive calculations to worker threads or split up processing and make sure the queue gets polled regularly. If the application doesn't poll the eventqueue for a while (5 seconds), for example when doing a long calculation, then Windows assumes that the application is hung and alerts the user.
An application gets the events from a queue provided by Windows.