Fortunately, after I played the sample code, I have what I want. This is actually EnvDTE.WindowEvents.
In the VS IDE, each code document is also a window. And this is the Focus: WindowActivated event. Here is my delegate to sign up for this event:
WinEvents.WindowActivated += new _dispWindowEvents_WindowActivatedEventHandler(WinEvents_WindowActivated);
void WinEvents_WindowActivated(Window GotFocus, Window LostFocus)
{
Debug.WriteLine("GotFocus: " + GotFocus.Caption );
}
Regards
Farrukh
source
share