Skip to content

How to tell if the app has been minimized or moved to the background #4357

Discussion options

You must be logged in to vote

On Windows 10, when it is minimized, it is not in Foreground anymore
So you can just test if it loses Foreground state, for example with Activated :

this.Activated += MainWindow_Activated;

with :

    private void MainWindow_Activated(object sender, WindowActivatedEventArgs args)
    {
        if (args.WindowActivationState == WindowActivationState.Deactivated)
            Console.Beep(8000, 10);
    }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DarrylDreiling-Sphero
Comment options

Answer selected by DarrylDreiling-Sphero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants