MessageBox supressess the Main App thread while opening, and when you press lock screen button the app, and every active thread goes in background. The main active app thread gets activated and the internally generated messagebox thread donot.
VisualTreeHelper.GetOpenPopups(); is the way you can check for all open popups. but the best and the most consistent solution is to use custom popups, messageboxes made in xaml. they never come up as seperate threads blocking the main UI thread.
A custom user control like this could help
<Border Name="bdrLeave" Visibility="Collapsed">
<Border.Background>
<ImageBrush Stretch="Fill" ImageSource="/Images/LoderBackground.png"/>
</Border.Background>
<StackPanel>
<StackPanel>
<StackPanel.Background>
<ImageBrush Stretch="Fill" ImageSource="/Images/Backgrounds/Main_BG.jpg"/>
</StackPanel.Background>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Text="Heading" HorizontalAlignment="Center" Foreground="#FF001C68" FontWeight="Bold" Margin="0,20,150,0"/>
<Button content="Close"/>
</StackPanel>
<TextBlock Text="Message" TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="#FF001C68" Margin="0,20,0,0"/>
<StackPanel Margin="0,20,0,20" Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="Content" Width="130"/>
<Button Content="Content" width "130"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Border>
VisualTreeHelper.GetOpenPopups();
while reactivating your app. this may helps you – Mohamed Thaufeeq