Search code examples
c#wpfstartupapp-startup

How to diagnose a program run by the user from a program run by Windows(run on windows startup)in C#?


i have a wpf program that can run in windows startup. i want to run program in WindowState.Normal mode when user run the program and in WindowState.Minimized when windows run the program at startup. but problem is that i do not know how to distinguish between them.


Solution

  • One way to do it would be to use a launcher app, an app's who's sole purpose is to launch your main application with a command line argument that says that the user launched it. If that command line argument is there, it was launched by the launcher and you can show it in normal mode. If the argument isn't there it was launched by the OS and run it minimized.