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."