As mentioned in this technet article, there is a registry key to control the timeout for the task manager to determine whether or not an application is hung.  This same value also controls the timeout for ghosting/frosting to occur:

Registry key: HKCU\Control Panel\Desktop
Data type: REG_SZ
Value name: HungAppTimeout
Data: Milliseconds (in decimal)

The value is only registered at bootup.  Thus, altering the value requires a reboot in order to be recognized.  If this registry value is not present at bootup, a default value of 5000 (5.0 seconds) is used.

Some test labs may wish to change the value to a smaller timeout in order to catch hang prone code before release.  However, not all test automation will allow the ghost window transition to occur.  Only a particular set of events will allow that to happen such as mouse clicks (actual, not simulated via SendMessage or PostMessage) or touch input events.  Using SendInput to simulate mouse clicks will allow this transition to happen.