共用方式為


IDebugProgramPublisher2

 

如需 Visual Studio 2017 的最新文件請參閱 Visual Studio 2017 文件

這個介面可讓偵錯引擎 (DE) 或註冊適用於偵錯程式的自訂連接埠供應商。

語法

IDebugProgramPublisher2 : IUnknown  

實作者注意事項

Visual Studio 會實作這個介面來註冊,才能偵錯可跨多個處理序會顯示偵錯的程式。

呼叫端資訊

呼叫 COM 的CoCreateInstance函式與CLSID_ProgramPublisher以取得此介面 (請參閱範例)。 DE 或自訂連接埠供應商使用此介面來登錄代表正在偵錯程式的程式節點。

依照 Vtable 順序的方法

這個介面會實作下列方法︰

方法 說明
PublishProgramNode 讓程式節點使用 DEs 和工作階段偵錯管理員 (SDM)。
UnpublishProgramNode 移除程式節點,使它不再提供。
PublishProgram 讓程式使用 DEs 和 SDM。
UnpublishProgram 移除程式,因此不再提供。
SetDebuggerPresent 設定旗標,表示偵錯工具已存在。

備註

此介面提供的程式和程式的節點 (也就是 「 發行 」) 以供 DEs 和工作階段偵錯管理員 (SDM)。 若要存取已發行的程式和程式節點,請使用IDebugProgramProvider2介面。 這是 Visual Studio 能夠辨識程式正在偵錯的唯一方法。

需求

標頭︰ msdbg.h

命名空間︰ Microsoft.VisualStudio.Debugger.Interop

組件︰ Microsoft.VisualStudio.Debugger.Interop.dll

範例

這個範例示範如何具現化程式發行者和註冊程式節點。 這取自教學課程中,發佈程式節點

// This is how m_srpProgramPublisher is defined in the class definition:  
// CComPtr<IDebugProgramPublisher2> m_srpProgramPublisher.  
  
void CProgram::Start(IDebugEngine2 * pEngine)  
{  
    m_spEngine = pEngine;  
  
    HRESULT hr = m_srpProgramPublisher.CoCreateInstance(CLSID_ProgramPublisher);  
    if ( FAILED(hr) )  
    {  
        ATLTRACE("Failed to create the program publisher: 0x%x.", hr);  
        return;  
    }  
  
    // Register ourselves with the program publisher. Note that  
    // CProgram implements the IDebgProgramNode2 interface, hence  
    // the static cast on "this".  
    hr = m_srpProgramPublisher->PublishProgramNode(  
        static_cast<IDebugProgramNode2*>(this));  
    if ( FAILED(hr) )  
    {  
        ATLTRACE("Failed to publish the program node: 0x%x.", hr);  
        m_srpProgramPublisher.Release();  
        return;  
    }  
  
    ATLTRACE("Added program node.\n");  
}  

另請參閱

核心介面
IDebugProgramProvider2