DebuggerEventsClass.OnContextChanged 事件

定义

每次通过用户界面或自动化模型更改了当前进程、程序、线程或堆栈时都会激发。

此 API 支持产品基础结构,不能在代码中直接使用。

public:
 virtual event EnvDTE::_dispDebuggerEvents_OnContextChangedEventHandler ^ OnContextChanged;
public:
 virtual event EnvDTE::_dispDebuggerEvents_OnContextChangedEventHandler ^ OnContextChanged;
public virtual event EnvDTE._dispDebuggerEvents_OnContextChangedEventHandler OnContextChanged;
member this.OnContextChanged : EnvDTE._dispDebuggerEvents_OnContextChangedEventHandler 
Public Overridable Custom Event OnContextChanged As _dispDebuggerEvents_OnContextChangedEventHandler Implements OnContextChanged

事件类型

_dispDebuggerEvents_OnContextChangedEventHandler

实现

示例

下面的示例演示如何使用 OnContextChanged 事件。

// Place the following code in the event handler  
EnvDTE.DebuggerEvents debugEvents = applicationObject.Events.DebuggerEvents;  
debugEvents.OnContextChanged +=   
new _dispDebuggerEvents_OnContextChangedEventHandler(DebuggerEvents.ContextHandler);  

// Place the following Event handler code  
public static void StartEvents(DTE dte)  
{  
    System.Windows.Forms.MessageBox.Show("Events are attached.");  
}  

public static void ContextHandler(EnvDTE.Process newProc,   
    EnvDTE.Program newProg, EnvDTE.Thread newThread, EnvDTE.StackFrame newStkFrame)  
{  
    System.Windows.Forms.MessageBox.Show("Debugger enters context changed mode.");  
}  

适用于