Drew
Drew

Reputation: 13418

Application.Idle only fires after I mouse over my tray icon

I want to show a BalloonTip in the Application.Idle event of my program, but for some reason the Application.Idle event only fires after I mouse over the NotifyIcon. What gives?

Upvotes: 1

Views: 588

Answers (1)

VinayC
VinayC

Reputation: 49245

Are you sure that Application.Idle is not getting fired? Simple way would be to log into the file whenever code enters the event and see if this happening.

Also understand that this event may not be suitable for your needs - it happens when message pump becomes empty (typically no keyboard/mouse input) - so as such you would probably receive this event too frequently (see this SO thread to understand more). In this case, I suspect that windows is suppressing the balloon tip perhaps because it is being shown too frequently.

As such, you can code to show the tip only if it has not been shown say in last 2-3 seconds. You may want to look at different implementations of Idle detection to suit your requirements - have a look at:

  1. http://ellisweb.net/2008/02/detecting-application-idle-state-in-windows-forms/
  2. http://blog.opennetcf.com/ctacke/2009/05/19/DetectingApplicationIdle.aspx
  3. http://www.codeproject.com/KB/miscctrl/Application_Idle.aspx

Upvotes: 1

Related Questions