问题
This one has been a bit of a pain due to a similarly named feature in Visual Studio (which I won't mention here for the sake of people searching).
What I'd like to do is to listen to events regarding which document window has focus
I wish my extension to behave differently depending which SolutionItem is open and has focus. I'd assume there is an event somewhere which will inform me when this focus changes.
I've found where I can listen to when a document opens and closes, but not when a document window has focus.
回答1:
It depends on if you're interested in window events or hierarchy/project selection events.
For Window events (i.e. document/tool window changes in focus), use IVsWindowFrameNotify3.
For Hierarchy/Project item selection change events, check out IVsMonitorSelection.
来源:https://stackoverflow.com/questions/7575607/are-there-any-document-window-focus-events