Close TrayIcon Balloon Programmatically

Is it possible to programmatically close the tip of a TTrayIcon ball?

Problem:

I have a timer that checks messages every minute. When it detects a message (for example, ABC Service stops), it displays a balloon with the message:

procedure TFrmTest.tmrTimer(Sender: TObject);
begin
  tmr.Enabled := False;
  try
    if IsAnyServiceStopped then
      ShowBallon(bfError, 'The ABC Service is stopped. Do something!!!');
  finally
    tmr.Enabled := True;
  end;
end;

procedure TfrmTest.ShowBallon(pFlag: TBalloonFlags; pMessage: string);
begin
  try
    // HERE I'D LIKE TO CLOSE THE BALLOON IF IT OPENNED
    TrayIcon.BalloonFlags := pFlag;
    TrayIcon.BalloonHint := pMessage;
    TrayIcon.ShowBalloonHint;
  except
  end;
end;

TrayIcon BalloonTimeOut is set to 3000 (3 seconds). Since the timer starts the message every minute (when there is any message), if the user does not close it, the system creates a message queue. If the user returns to the PC after 30 minutes (for example), they will close the first message, and then the tray icon will display the second message and the same for the next 28 messages (bad user).

, , , - ( , ). , , .

, , , ( ). , ( OnBalloonClick , X ).

+4
1

NOTIFYICONDATA , szInfo:

, ( NIM_DELETE) NIF_INFO uFlags szInfo .

TTrayIcon ( , Delphi) , , TTrayIcon , NIF_INFO, szInfo . TTrayIcon szInfo BalloonHint, , , :

TrayIcon.BalloonHint := '';
+3

All Articles