Run the program at startup

I am currently working on a C # wpf project. I added code to the program to create a registry key to automatically run the program when I logged in, as well as write the program so that it can minimize the system tray.

When a user launches a program manually manually, I obviously want the program to appear in the middle of the screen, as usual, but when the program starts automatically at startup, I want it to be minimized.

Is there a way to determine if the program was launched by the user or started at startup, so that I can minimize the load, and not appear on the screen at startup.

+4
source share
1 answer

The easiest way is to register your registry keys with a command line argument, so that when the program starts automatically, you can simply check the arguments in your main method.

Until the user starts it from the command line with this argument, you can determine whether the program was launched automatically or clicked on the icon.

+9
source

All Articles