Capture window close event

Posted by -providergordienko.vladimir on Stack Overflow See other posts from Stack Overflow or by -providergordienko.vladimir
Published on 2009-09-03T13:27:18Z Indexed on 2010/04/04 20:53 UTC
Read the original article Hit count: 471

Filed under:
|
|
|
|

I want to capture events that close editor window (tab) in Visual Studio 2008 IDE. When I use dte2.Application.Events.get_CommandEvents(null, 0).BeforeExecute I successfully captured such events:

  • File.Close
  • File.CloseAllButThis
  • File.Exit
  • Window.CloseDocumentWindow and others.

If code in window is not acceptable, I stop the event (CancelDefault = true).

But if I click "X" button on the right hand side, "Save Changes"; dialog appears, tab with editor window close and I have no any captured events. In this case I can capture WindowClosing event, but can not cancel the event.

Is it poosible to handle "x" button click and stop event?

© Stack Overflow or respective owner

Related posts about envdte

Related posts about c#