Share via


DebuggerEventsClass.OnContextChanged 이벤트

이 API는 .NET Framework 인프라를 지원하며 사용자 코드에서 직접 사용할 수 없습니다.

현재 프로세스, 프로그램, 스레드 또는 스택이 사용자 인터페이스나 자동화 모델을 통해 변경될 때마다 발생합니다.

네임스페이스:  EnvDTE
어셈블리:  EnvDTE(EnvDTE.dll)

구문

‘선언
Public Overridable Event OnContextChanged As _dispDebuggerEvents_OnContextChangedEventHandler
public virtual event _dispDebuggerEvents_OnContextChangedEventHandler OnContextChanged
public:
virtual   event _dispDebuggerEvents_OnContextChangedEventHandler^ OnContextChanged {
    void add (_dispDebuggerEvents_OnContextChangedEventHandler^ value);
    void remove (_dispDebuggerEvents_OnContextChangedEventHandler^ value);
}
abstract OnContextChanged : IEvent<_dispDebuggerEvents_OnContextChangedEventHandler,
    EventArgs>
override OnContextChanged : IEvent<_dispDebuggerEvents_OnContextChangedEventHandler,
    EventArgs>
JScript에서는 이벤트를 지원하지 않습니다.

구현

_dispDebuggerEvents_Event.OnContextChanged

예제

다음 예제에서는 OnContextChanged 이벤트의 사용 방법을 보여 줍니다.

이 이벤트를 테스트하려면

  1. 대상 응용 프로그램을 엽니다.

  2. 추가 기능을 실행합니다.

    "Events are attached.” 메시지 상자가 나타납니다.

  3. 중단점을 설정하고 디버그 모드에서 대상 응용 프로그램을 실행합니다.

  4. 응용 프로그램이 중단점에서 멈추면 디버거를 중지합니다.

    “Debugger enters context changed mode." 메시지 상자가 나타납니다.

// Place the following code in the Exec method of the add-in:
EnvDTE.DebuggerEvents debugEvents = applicationObject.Events.DebuggerEvents;
debugEvents.OnContextChanged += 
new _dispDebuggerEvents_OnContextChangedEventHandler(DebuggerEvents.ContextHandler);

// Place the following Event handler code in the add-in:
// Needed to activate event handlers in Connect.Exec.
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.");
}

.NET Framework 보안

참고 항목

참조

DebuggerEventsClass 클래스

EnvDTE 네임스페이스