locked
Questio about _dispDTEEvents_ModeChangedEvent RRS feed

  • Question

  • I am writing Add Ins code which gets executed when an application is run and I have a question about the _dispDTEEvents_ModeChangedEvent. I noticed that when I run an app and click on the menu option of Debug - Start, the event gets fired whenever the mode of the environment changes. However, when I click on Debug - Start Without Debugging and the mode changes, the event does not get fired. I'm confused about why the behavior is different when starting without debugging and how to capture the mode change if the app was started without debugging.

    Monday, July 12, 2010 8:32 PM

Answers

  • Hi again,

    I think just within add-in is not enough to capture the event when a running application is stopped, you can try the method Process.WaitForExit (http://msdn.microsoft.com/en-us/library/fb4aw7b8.aspx) before capturing the event.

    If you still have problem, be free to let me know.

    Best Regards,

    /Victor

    • Proposed as answer by Chao Kuo Wednesday, July 14, 2010 3:40 AM
    • Marked as answer by Chao Kuo Monday, July 19, 2010 2:28 AM
    Tuesday, July 13, 2010 6:26 AM

All replies

  • Hi Sir,

    As you know the IDE can be in one of the three mode:

    • Design-time: this is the mode that you use to code or design your application.
    • Run-time: this is the mode when your application is running.
    • Debug-time: this is the mode when you debug your running application.

    But in the vsIDEMode Enumeration we just have two:

    • vsIDEModeDesign
    • vsIDEModeDebug

    You can reference: http://msdn.microsoft.com/en-us/library/envdte.vsidemode.aspx

    When you start without debugging, the mode is not changed but remains design mode, but when you start debugging, it changes to debug mode.

    If you want to capture the mode change,  you can use the EnvDTE.DebuggerEvents class, that provides the OnEnterDesignMode, OnEnterBreakMode and OnEnterRunMode events to track the current mode.

    You can reference: http://msdn.microsoft.com/en-us/library/envdte.debuggereventsclass.aspx

    I hope this can make some help.

    Best Regards,

    /Victor

     

    Tuesday, July 13, 2010 2:15 AM
  • Hi Victor,

    Thanks for your response. I am aware of the debugger events class. I was trying to capture the event when a running application (which was started without debugging) is stopped.

    -SR

    Tuesday, July 13, 2010 4:45 AM
  • Hi again,

    I think just within add-in is not enough to capture the event when a running application is stopped, you can try the method Process.WaitForExit (http://msdn.microsoft.com/en-us/library/fb4aw7b8.aspx) before capturing the event.

    If you still have problem, be free to let me know.

    Best Regards,

    /Victor

    • Proposed as answer by Chao Kuo Wednesday, July 14, 2010 3:40 AM
    • Marked as answer by Chao Kuo Monday, July 19, 2010 2:28 AM
    Tuesday, July 13, 2010 6:26 AM