tags:

views:

119

answers:

1

Hello,

I use the Application.Idle event to handle toolbar status (enable/disable) etc. quite extensively. As I'm beta testing Norton AntiVirus 2011, it brought to my attention that my app that I'm developing triggered a high CPU usage warning on at least one CPU. Sure enough, I opened the task manager and watched one of the four CPU's (quad core system) go to near 100%.

I thought Application.Idle was the way to handle things when the application wasn't performing CPU tasks. Why is Application.Idle spiking the CPU?

Here is how I attach to the event:

AddHandler Application.Idle, AddressOf OnAppIdle

Been using Application.Idle for a long time, never knew it would have this issue.

Using VS 2010 .NET 4

Thank you.

A: 

Since you say you are using Application.Idle to handle toolbar status, I would conclude that the code you're running in the Idle event handler is probably generating Windows messages. Which will be processed, and when processing is finished, Application.Idle will be called again, and so on...

You could try reducing the number of messages you generate in your idle handler - perhaps only modifying toolbar status, or whatever you are doing, if it is actually necessary.

If you post the code from the Idle event handler you may get more help.

Joe