Alexander Molodih
Alexander Molodih

Reputation: 1936

NotifyIcon.ShowBalloonTip not keeps timeout

I show notify information:

 notifyIcon.ShowBalloonTip(29000, "title", "message", ToolTipIcon.Info);

It should show 29 000 milliseconds, but it disappears in less than a second.

I understand this is controlled by the operating system. But there should be a way to increase the duration of the show?

Use windows 7.

Upvotes: 12

Views: 16141

Answers (4)

Krishnraj Rana
Krishnraj Rana

Reputation: 6656

I know this is very old question to answer now, But its for future reference and for those readers who will come across this question.

Well I had the same issue as mentioned in question in one of my winform application and then i came across this Github link - Windows Toast Notifications

Yes it's very easy to integrate in your c# winform application. What all you have to do is -

  • Download the code from the above Github link.
  • Add the following class files to your c# winform application

    FormAnimator.cs

    NativeMethods.cs

  • Add the Notifications.cs form to your application

  • Create a toast notification form object in your project's code and call Show() method to display it.

Sample code

var toastNotification = new Notification
(
    "My Notification", 
    message, 
    durationsTime, 
    FormAnimator.AnimationMethod.Slide,
    FormAnimator.AnimationDirection.Up
);

//PlayNotificationSound("normal");
toastNotification.Show();

Upvotes: 2

Alexander Molodih
Alexander Molodih

Reputation: 1936

It depends from OS setups, in each OS it is different. Best way is in using a self created baloon.

Upvotes: 2

Justin
Justin

Reputation: 4072

From the MSDN article on ShowBalloonTip

"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. 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."

You can read about the entire function below:

http://msdn.microsoft.com/en-us/library/ms160064.aspx

Upvotes: 13

Evan Mulawski
Evan Mulawski

Reputation: 55354

Make sure the NotifyIcon is visible before showing the balloon:

notifyIcon.Visible = true;
//then show the balloon tip

Also, if any other balloon tips are showing, yours will be ignored.

http://msdn.microsoft.com/en-us/library/ms160065.aspx

Upvotes: 2

Related Questions