Home All Groups Group Topic Archive Search About

NotifyIcon Balloon Tips

Author
15 May 2009 3:37 PM
Mike
I notice the same issue we had with NotifyIcon Balloon tips under
C/C++ is persistent with the .NET NotifyIcon class.

At issue is, the balloon tip does not work or rather the time to close
does not work under certain OS versions. What happens the tip pops up
but doesn't go away after the time (expires).

Does anyone know if this has been resolved? or some method is used
under .NET?

In my C/C++ code, I used a timer to disable the balloon tip so that it
works the same across all Windows OSes.

So I did the same here, by adding a BallonTipTimer and a countdown
like so:

Public Class Form1

     Private BalloonTipTime As Integer = 5 ' seconds

     Private Sub Form1_Load( _
            ByVal sender As Object, _
            ByVal e As System.EventArgs) Handles Me.Load
       NotifyIcon1.ShowBalloonTip(BalloonTipIntTime * 1000)
       BalloonTipTimer.Start()
     End Sub

     Private Sub BalloonTipTimer_Tick( _
             ByVal sender As System.Object, _
             ByVal e As System.EventArgs) Handles BalloonTipTimer.Tick

       BalloonTipInterval -= 1
       If (BalloonTipTime <= 0) Then
           BalloonTipTimer.Stop()
           NotifyIcon1.Visible = False ' hide icon
           NotifyIcon1.Visible = True  ' reshow icon without tip
       End If
     End Sub
End Class

Is there an alternative method under .NET?  This is the sort of thing
I was hoping to eliminate by using .NET more.

---

Author
15 May 2009 5:37 PM
Thorsten Doerfler
Mike schrieb:
> I notice the same issue we had with NotifyIcon Balloon tips under
> C/C++ is persistent with the .NET NotifyIcon class.
>
> At issue is, the balloon tip does not work or rather the time to close
> does not work under certain OS versions. What happens the tip pops up
> but doesn't go away after the time (expires).

This is by design. The ballon go away in the given time if there is an
user present. Detected is this by mouse movement and keyboard input.

NOTIFYICONDATA Structure
http://msdn.microsoft.com/en-us/library/bb773352.aspx

"Remarks
[...]
If the user does not appear to be using the computer, the system does
not count this time towards the timeout."

Thorsten Doerfler
--
Microsoft MVP Visual Basic

vb-hellfire visual basic faq  | vb-hellfire - einfach anders
http://vb-faq.de/             | http://www.vb-hellfire.de/