How do I know when my WinForms program has lost focus?
Posted on 2009-12-17
I need to set a breakpoint in my Winforms application, on a machine I can not watch constantly. But I want to email myself the second the breakpoint has been hit.
So I'd like to catch the event where my program loses focus. I assume when Visual Studio grabs focus, to display the breakpoint, my code would execute for that lose focus event.
What event is that? I would rather NOT be that my FORM has lost focus, since I'd get emailed any time another form in my program opens. Instead, I'd like it to be that my PROGRAM has lost focus to another program, in this case Visual Studio.
How do I do that? What's the property name?