This one made me want to tear my hair out.

It all happened after I rebooted my Windows 7 workstation following a larger than usual set of Windows Updates. After the reboot, everything worked correctly, except that every time I moved the mouse, windows started to flicker.

There were other, minor oddities, too, for instance the little speaker icon in the lower right indicated that the Windows Audio service has not been started yet, despite the fact that it was running and audio was working correctly. Stopping and restarting the audio service fixed this annoyance, but still, it left me wondering what was going on. (Past experience taught me never to ignore even such minor things. They might be a symptom of something more serious going on, such as malicious software on my workstation.)

No, it was not a driver issue, despite many well-meaning but clueless Web pages that advised you to rip out and reinstall video drivers to get rid of the flicker. No, it was not a startup issue either. And despite the fact that it happened right after a Windows Update (which, incidentally, included a botched update that keeps wanting to reinstall itself even after a successful installation) it was not a faulty update from Microsoft either.

That "Not Responding" thing was a strong clue. I suspected that the problem may have something to do with how Windows detects a hung application. And I was right. Thankfully, indeed almost miraculously, I found a link that not only described my problem but also provided a solution.

To make a long story short: blame Windows's built-in shutdown optimization. You need to get rid of the following Registry entries (not all of them may exist) and then reboot the system (logging off and logging on might also be sufficient, but I have not tried it):

HKEY_USERS\.DEFAULT\Control Panel\Desktop\HungAppTimeOut
HKEY_USERS\.DEFAULT\Control Panel\Desktop\WaitToKillAppTimeOut
HKEY_CURRENT_USER\Control Panel\Desktop\HungAppTimeOut
HKEY_CURRENT_USER\Control Panel\Desktop\WaitToKillAppTimeOut
HKEY_CURRENT_USER\Control Panel\Desktop\WaitToKillServiceTimeOut

Now that this problem is solved, I wonder if there is a magic way to get back all the hours of my life I spent last night trying to fix it?

Update (2013-09-12): I was blaming Microsoft but it turned out that in my case, these Registry entries were not created by Microsoft, but by customer software that I was testing on my workstation.