Snethil

Hi,

I need to capture the event of navigation from one code window to another window.. For ex, if 2 files named abc.vb and xyz.xml are open in a Visual Studio IDE, and I am switching between these 2 files, I need to capture each switch... I tried the get_windowevents method but it fires the event everytime even for other windows like solution explorer, properties window etc...Can anyone help on this please..

thanks.



Re: Visual Studio Extensibility How to capture the event of navigation from one file to another

Carlos Quintero - MVP

There are two concepts:

- The active window, which can be a document window or a toolwindow (which can appear tabbed such as the Objec Browser or not such as the Solution Explorer, but don't ge confused by that, both are toolwindows)

- The active document. You can have an active document even if its window is not active (because a toolwindow is active)

And you have the WindowsEvents and the DocumentEvents (see http://msdn2.microsoft.com/en-us/library/envdte.documenteventsclass_members(VS.80).aspx).

And you have Document.Windows, Document.ActiveWindow and Window.Document, so you can know if a window has a document or not, etc.

With all that you need to figure out how you want your tools to behave.

See also:

BUG: Document.ActiveWindow does not return always the active window in Visual Studio .NET

http://support.microsoft.com/kb/555117/en-us






Re: Visual Studio Extensibility How to capture the event of navigation from one file to another

Snethil

Thanks for your response..



Re: Visual Studio Extensibility How to capture the event of navigation from one file to another

sean.e

see also: DTE.ActiveDocument does not always return the correct document

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx FeedbackID=261245