Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Balloon hints on Delphi app tray icon keep popping up indefinitely

I have a Delphi 2006 app that can minimize to a tray icon, and displays various alert messages via a balloon hint over the tray icon.

Under some circumstances - I don't know when - a previously displayed balloon hint keeps popping up and won't go away. It displays for the length of time programmed, closes, then immediately reappears.

It is always a balloon hint from this app.

If the app displays another balloon hint, that one shows for the programmed time, then the phantom hint resumes.

It is as if the hint is stuck in a queue somewhere and doesn't get removed. In absence of anyone with some inspiration (I realise it's a long shot...), does anyone know how to purge the balloon hints?

like image 376
rossmcm Avatar asked Nov 16 '10 08:11

rossmcm


1 Answers

Which TrayIcon are you using? The TCustomTrayIcon in "Vcl.ExtCtrls" uses TNotifyIconData to send the Popup to the TrayIcon. Some properties require Windows Vista or later.

public
  FData: TNotifyIconData; //Winapi.ShellAPI

procedure TCustomTrayIcon.ShowBalloonHint;
begin
  FData.uFlags := FData.uFlags or NIF_INFO;
  FData.dwInfoFlags := Cardinal(FBalloonFlags);
  Shell_NotifyIcon(NIM_MODIFY, FData); //Refresh(NIM_MODIFY);
end;

You can see whats going on by handling messages send by the trayicon.

NIN_BALLOONSHOW      = WM_USER + 2;
NIN_BALLOONHIDE      = WM_USER + 3;
NIN_BALLOONTIMEOUT   = WM_USER + 4;
NIN_BALLOONUSERCLICK = WM_USER + 5;  
like image 101
A1rPun Avatar answered Sep 28 '22 16:09

A1rPun