Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to make a Balloon Tip never close?

My application is a monitor that may run in the background while the user is away, and its purpose is to visually alert the user when some changes have occurred. MessageBoxes seem a little obnoxious, so I figure a Balloon Tip will accomplish the task without messing with the focus in case they happen to be doing something.

Unfortunately, the thing requires a timeout parameter. I would like for it to stay indefinitely until the user closes it.

Is this possible?

like image 538
Corey Avatar asked Dec 22 '22 21:12

Corey


2 Answers

As far as I can tell, it's not possible to specify an infinite timeout.

That said, if you set the timeout to Int32.MaxValue, the tooltip will wait for 2,147,484 seconds, i.e. roughly 25 days. Chances are that your user will have noticed the tooltip by then, or that he/she never will.

EDIT: @Hans Passant mentions a system setting that puts an upper bound on the timeout value, so... that probably won't work after all. His answer is better anyway.

like image 45
Frédéric Hamidi Avatar answered Jan 09 '23 02:01

Frédéric Hamidi


This is already taken care of by Windows. The timeout counter doesn't start ticking until it detects keyboard or mouse input. From the Remarks section of NotifyIcon.ShowBalloonTip:

In addition, if the user does not appear to be using the computer (no keyboard or mouse events are occurring) then the system does not count this time towards the timeout.

like image 157
Hans Passant Avatar answered Jan 09 '23 03:01

Hans Passant