title: How to program to prevent the Windows "Not Responding" dialog
body: <p>When an application fails to be responsive for 5 seconds (<a href="https://superuser.com/a/961910/138951" title="source">source</a>), Windows can display "(Not Responding)" in the title bar and in some cases show a "not responding" dialog:</p>
  
  <p><a href="https://i.stack.imgur.com/Gn3ub.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gn3ub.png" alt="Not Responding dialog"></a></p>
  
  <p>Ideally, the 5+ second execution should not block the main/event-processing thread, but is there a simple (e.g. 1 liner for MFC C++) way to communicate to Windows that the main thread is busy and shouldn't be treated as a "Not Responding" application to be closed?  Is the quickest hack to simply periodically call peak <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms644943%28v=vs.85%29.aspx" rel="nofollow noreferrer">PeekMessage</a> with <code>PM_NOREMOVE</code>?</p>