May 18th, 2011

How long do taskbar notification balloons appear on the screen?

We saw some time ago that taskbar notification balloons don’t penalize you for being away from the computer. But how long does the balloon stay up when the user is there?

Originally, the balloon appeared for whatever amount of time the application specified in the uTimeout member of the NOTIFYICONDATA structure, subject to a system-imposed minimum of 10 seconds and maximum of 60 seconds.

In Windows XP, some animation was added to the balloon, adding 2 seconds of fade-in and fade-out animation to the display time.

Starting in Windows Vista, applications are no longer allowed to specify how long they wanted the balloon to appear; the uTimeout member is ignored. Instead, the display time is the amount of time specified by the SPI_GETMESSAGEDURATION system parameter, with 1 second devoted to fade-in and 5 seconds devoted to fade-out, with a minimum of 3 seconds of full visibility. In other words, if you set the message duration to less than 1+3+5=9 seconds, the taskbar behaves as if you had set it to 9 seconds.

The default message duration is 5 seconds, so in fact most systems are in the “shorted possible time” case. If you want to extend the time for which balloons notification appear, you can use the SystemParametersInfo function to change it:

BOOL SetMessageDuration(DWORD seconds, UINT flags)
{
 return SystemParametersInfo(SPI_SETMESSAGEDURATION,
                             0, IntToPtr(seconds), flags);
}

(You typically don’t need to mess with this setting, because you can rescue a balloon from fading out by moving the mouse over it.)

Note that an application can also set the NIF_REALTIME flag, which means “If I can’t display the balloon right now, then just skip it.”

Topics
History

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

0 comments

Discussion are closed.