winapitaskbartooltipballoon

How to hide a taskbar balloon at will?


It's very easy to force a taskbar icon to display a balloon tooltip: all I need to do is set the NIF_INFO flag when calling Shell_NotifyIcon( NIM_MODIFY, ... ), and the balloon appears, no problem.

Now, I want to be able to hide the balloon when I no longer need it, as well, but I can't find a way to do that. I tried clearing the NIF_INFO flag and calling Shell_NotifyIcon( NIM_MODIFY, ... ), but the balloon remained. It does disappear by itself, a few seconds later, but that's not what I want: I want to hide it right away, when my program thinks it should be hidden.

The only way to make the balloon disappear seems to be to destroy the icon and then add it to the taskbar again, but it's ugly.

Is it possible to hide the balloon without recreating the taskbar icon? Thanks.


Solution

  • To immediately hide a balloon, set the szInfo member of the NOTIFYICONDATA to an empty string, like nid.szInfo[0] = 0; and call Shell_NotifyIcon( NIM_MODIFY, &nid ).