Debugger3.RunToCursor 方法 (Boolean)

執行程式前往原始程式檔游標目前的位置。

命名空間:  EnvDTE90
組件:  EnvDTE90 (在 EnvDTE90.dll 中)

語法

'宣告
Sub RunToCursor ( _
    WaitForBreakOrEnd As Boolean _
)
void RunToCursor(
    bool WaitForBreakOrEnd
)
void RunToCursor(
    [InAttribute] bool WaitForBreakOrEnd
)
abstract RunToCursor : 
        WaitForBreakOrEnd:bool -> unit 
function RunToCursor(
    WaitForBreakOrEnd : boolean
)

參數

  • WaitForBreakOrEnd
    型別:System.Boolean
    設定為 true,表示這項函式呼叫在傳回之前必須等候,直到進入中斷模式或設計模式為止。設定為 false,表示您希望這項呼叫在引發偵錯工具開始執行之後,能夠立即傳回。傳回時,偵錯工具可能是在設計、中斷或執行模式下。
    如需詳細資訊,請參閱程式碼逐步執行概觀。

實作

Debugger2.RunToCursor(Boolean)

備註

RunToCursor 會執行程式至原始程式檔游標目前的位置。 如需詳細資訊,請參閱HOW TO:執行至特定位置

範例

下列範例示範如何使用 RunToCursor 方法。

若要測試這個方法:

  • 開啟目標專案並執行增益集。
public static void RunToCursor(EnvDTE80.DTE2 dte)
{
    EnvDTE.TextSelection ts = 
    (EnvDTE.TextSelection)dte.ActiveDocument.Selection;
    ts.GotoLine(15, false);
    EnvDTE90.Debugger3 debugger = (EnvDTE90.Debugger3)dte.Debugger;

    debugger.RunToCursor(true);

    // Setup debug Output window.
    Window w = 
   (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("RunToCursor Method 
    Test");
    owp.Activate();
    if (debugger.CurrentProgram.IsBeingDebugged)
        owp.OutputString("This program is being debugged and " +
                         "the cursor is on line: " + ts.CurrentLine);
    else
        owp.OutputString("This program is not being debugged.");
}
Sub RunToLine(Optional ByVal line As Integer = -1)
    If line <> -1 Then
        Dim ts As TextSelection
        ts = DTE2.ActiveDocument.Selection
        ts.GotoLine(line)
        DTE2.Debugger.RunToCursor()
    End If
End Sub

.NET Framework 安全性

請參閱

參考

Debugger3 介面

RunToCursor 多載

EnvDTE90 命名空間