C# WPF Deactivated event is not sent when the MS Teams screen sharing lags

justRomm 0 Reputation points
2024-02-02T16:52:03.4533333+00:00

I have a C# WPF application in which I subscribe application's Main Window to Deactivated event which was working fine and hides my app when I clicks on other app or on a desktop. But I got a problem with it. When I start sharing my entire screen in MS teams (win 11, in win10 I wasn't been able to reproduce it), there is a lag which hides taskbar for a second and after it Deactivated event (when I click into another app, or a desktop) is not being sent completely. I have tried to use WndProc and try to monitor the events. When there is no such Teams lag, WM_NCACTIVATE and WM_ACTIVATE messages are being sent, but with it, there is no these messages at all. So, the question is: how can I monitor the activation state of the app with something different from a WM_NCACTIVATE, WM_ACTIVATE and Deactivated event?

Developer technologies Windows Presentation Foundation
Microsoft Teams Microsoft Teams for business Other
Developer technologies C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.