I'm very much newbie to VS Addins.
Although, I subscribed to DocumentEvent.DocumentOpened. But additionally, I need to detect if already opened document got focus and I will read its contents then.
How to get its focused state?
Thanks
Farrukh
I'm very much newbie to VS Addins.
Although, I subscribed to DocumentEvent.DocumentOpened. But additionally, I need to detect if already opened document got focus and I will read its contents then.
How to get its focused state?
Thanks
Farrukh
Luckily, after playing some sample code, I've got what I want. Its actually EnvDTE.WindowEvents.
In VS IDE, every Code Document is also a Window. And it has the Focus event: WindowActivated. Here is my delegate to subscribe for this event:
WinEvents.WindowActivated += new _dispWindowEvents_WindowActivatedEventHandler(WinEvents_WindowActivated);
void WinEvents_WindowActivated(Window GotFocus, Window LostFocus)
{
Debug.WriteLine("GotFocus: " + GotFocus.Caption );
//throw new NotImplementedException();
}
Best regards
Farrukh