Results 1 to 11 of 11

Thread: NotifyIcon balloon disappearing before timeout

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,373

    NotifyIcon balloon disappearing before timeout

    I am displaying a system tray balloon via a NotifyIcon. I am setting the timeout to the maximum with:

    NotifyIcon.ShowBalloonTip(Int32.MaxValue)

    yet the balloon is disappearing within 10 seconds.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: NotifyIcon balloon disappearing before timeout

    Sometimes I wish that i could automatically send an electric shock over the internet to anyone who hasn't read the documentation. It took me about 7 seconds to display the MSDN documentation for the ShowBalloonTip method and a couple of seconds later I was reading this:
    Minimum and maximum timeout values are enforced by the operating system and are typically 10 and 30 seconds, respectively, however this can vary depending on the operating system. Timeout values that are too large or too small are adjusted to the appropriate minimum or maximum value.
    When it was so easy to find that information, why haven't you read it already?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,373

    Re: NotifyIcon balloon disappearing before timeout

    I recently upgraded a VS2005 application to VS2013. I think that this behaviour has changed. You used to be able to set a large number which effectively meant it remained visible until the user dismissed it. I have tried relatively small numbers like 15,000 and 30,000 which should display the balloon for 15 and 30 seconds but it is still disappearing after about 5 seconds in each case.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: NotifyIcon balloon disappearing before timeout

    What Framework version? What OS?

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,373

    Re: NotifyIcon balloon disappearing before timeout

    4.5/Windows 7 Pro

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: NotifyIcon balloon disappearing before timeout

    Does a brand new project behave the same way?

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,373

    Re: NotifyIcon balloon disappearing before timeout

    Yes it does. This is the code I am using.

    Code:
     With NotifyIcon1
                .Visible = True
                .Text = "Lorem ipsum dolor"
                .BalloonTipTitle = "Lorem ipsum dolor"
                .BalloonTipIcon = ToolTipIcon.Info
                .BalloonTipText = "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
                .ShowBalloonTip(30000)
    End With

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: NotifyIcon balloon disappearing before timeout

    I incorporated your code into an app like this:
    vb.net Code:
    1. Public Class Form1
    2.  
    3.     Private timer As Stopwatch
    4.  
    5.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    6.         With NotifyIcon1
    7.             .Visible = True
    8.             .Text = "Lorem ipsum dolor"
    9.             .BalloonTipTitle = "Lorem ipsum dolor"
    10.             .BalloonTipIcon = ToolTipIcon.Info
    11.             .BalloonTipText = "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."
    12.             .ShowBalloonTip(30000)
    13.         End With
    14.     End Sub
    15.  
    16.     Private Sub NotifyIcon1_BalloonTipShown(sender As Object, e As EventArgs) Handles NotifyIcon1.BalloonTipShown
    17.         Me.timer = Stopwatch.StartNew()
    18.     End Sub
    19.  
    20.     Private Sub NotifyIcon1_BalloonTipClosed(sender As Object, e As EventArgs) Handles NotifyIcon1.BalloonTipClosed
    21.         MessageBox.Show(Me.timer.ElapsedMilliseconds.ToString())
    22.     End Sub
    23.  
    24. End Class
    It was on Windows 8.1 Update but, no matter what value I used when calling ShowBalloonTip, I always got a value about 9360 displayed.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Posts
    1,373

    Re: NotifyIcon balloon disappearing before timeout

    It would seem there is a bug.

  10. #10
    Powered By Medtronic dbasnett's Avatar
    Join Date
    Dec 2007
    Location
    Jefferson City, MO
    Posts
    9,754

    Re: NotifyIcon balloon disappearing before timeout

    Quote Originally Posted by robertx View Post
    It would seem there is a bug.
    Since the documentation says, "Minimum and maximum timeout values are enforced by the operating system and are typically 10 and 30 seconds, respectively, however this can vary depending on the operating system.", it probably isn't a bug if the notification shows for 10 or 30 seconds.
    My First Computer -- Documentation Link (RT?M) -- Using the Debugger -- Prime Number Sieve
    Counting Bits -- Subnet Calculator -- UI Guidelines -- >> SerialPort Answer <<

    "Those who use Application.DoEvents have no idea what it does and those who know what it does never use it." John Wein

  11. #11
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,297

    Re: NotifyIcon balloon disappearing before timeout

    Quote Originally Posted by dbasnett View Post
    Since the documentation says, "Minimum and maximum timeout values are enforced by the operating system and are typically 10 and 30 seconds, respectively, however this can vary depending on the operating system.", it probably isn't a bug if the notification shows for 10 or 30 seconds.
    I'll test on some other OSes and other versions of .NET when I get the chance but I'd say that it's what the OS wants rather than a bug.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width