How to: Fire Events When the Editor Loses Focus
Sometimes it is necessary to know when an editor loses focus on the window frame. For example, you might need to extract code from a code window after the editor is no longer focused on it. The following procedure provides the steps to follow to receive notification of the editor losing focus.
To fire an event in response to an editor losing focus
Monitor selection events by obtaining an IVsMonitorSelection object from SVsShellMonitorSelection.
Call AdviseSelectionEvents and provide it your IVsSelectionEvents object.
In your call to OnElementValueChanged, look for elementid==SEID_WindowFrame.
Test the varValueNew parameter for two things:
The window frame you are looking for.
The point at which your program loses the selection to that window frame.