From my notes:
Patience is a virtue, but if Windows is taking too long to shut down recalcitrant programs, you can tell it to show the End Program option sooner. In fact, you can make Windows close the hung application without bothering you with a dialog box at all. Keep in mind, however, that if you choose the promptless option, you may damage your system settings by squashing a hung Windows process too quickly. (There's a middle road: You can retain the prompt and use a shorter timeout interval, since the dialog box always gives you the option of waiting longer.)
To make Windows automatically end hung processes, launch the Registry Editor as described previously, and navigate to and select HKEY_CURRENT_USER\Control Panel\Desktop. Double-click the AutoEndTasks icon in the right pane, change 'Value data' to 1, and press <Enter>. (Change it back to 0 if you later decide to revert to manual shutdown control.)
Next, double-click the HungAppTimeout icon in the same pane, and edit the 'Value data' field to reflect the time (in milliseconds) you are willing to wait for an unresponsive application.
The default setting is '5000', or 5 seconds. To reset the wait time for a program that is slow to shut down when Windows exits, double-click the WaitToKillAppTimeout icon in the same Registry pane, change the default of '20000' (milliseconds, or 20 seconds) to the maximum wait time of your choice, and press <Enter>.