How to: Know if a program was launched on boot
Wednesday, March 19th, 2008Sometimes you would like to know if your program was launched on the boot of the machine or activated by a user.
Here is a simple way to find just that in real-time.
What I would do to handle cases where the launch on boot is done through a shortcut is one of two options.
- If you can, add a parameter to the call of your application and check for it using the args[] in:
[MTAThread]
private static void Main(string args[])
{ - Use this post to know how long its passed since boot, check for a minimum period to know that it was started by the user, this is not bulletproof as it might take a while for boot to finish and your app to start but it is a solution when you have to do this.
Got any ideas yourself? let us know in the comments !
Good luck,
Nadav