I’m writing an application that will have an option to run on Windows Startup.
I can’t stand when applications bog my PC down before it has really settled, and this is a non-critical application. I’d like my application to politely wait for all other startup items to finish and settle so that the user’s PC becomes responsive before it starts doing any work.
How would I go about detecting this condition? I suppose I could traverse the registry and look for all startup processes to be running, or use a longish timer. I’m just hoping there is another less hackish trick I might use.
EDIT: The application has a UI and cannot run as a service. It does have a tray mode. It does some image rendering.
A ‘longish’ timer is the best route. I wouldn’t touch the registry with a bargepole.
One thing you will want to consider though is what happens if a user wants to launch your program themselves? Obviously you don’t want to be causing the delay then.
I assume your application has a UI? If not, you could consider a Service with its start type set to “Automatic (Delayed)” on Vista/7
Please also see this related question: How to create delay startup application in c#?
A final point, if your program is non-critical, and you are worried it might slow things down, consider lowering the priority of the application.