Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top