How to check if your Windows packaged app was launched from a StartupTask in C# and VB
Apps running on startup is very common in Windows these days; many apps do this in order to run in the background to provide services such as notifications or a tray/taskbar corner icon. Windows has multiple avenues apps can use to run on startup however, the concept is usually the same - apps can specify an executable to run on startup along with arguments either for all users or the current user and the executable will run when the user signs in. One of these avenues is the StartupTask feature of UWP/MISX packages. You can simply specify these in your app's manifest and your app will be able to run when the current user signs in. As a developer, you might want to write code to check if your app was launched by a startup task - this might be useful if, for example, you want your app to run in the background and not show a main window if it is launched automatically from a StartupTask. How to check if app was launched from a StartupTask The first thing we'll need to do is make ...