共用方式為


註冊自訂偵錯引擎

偵錯引擎必須將自己登錄為類別工廠遵循 COM 慣例,以及註冊與 Visual Studio 到 Visual Studio 的登錄子機碼。

注意事項注意事項

睡偟偵錯引擎的範例,請參閱 TextInterpreter 範例中,已內建的一部分Tutorial: Building a Debug Engine Using ATL COM

DLL 伺服器處理序

一般來說,偵錯引擎會在它自己的 DLL 中實作為 COM 伺服器。 這表示,Visual Studio 可以存取它之前偵錯引擎必須註冊 com 其類別工廠的 CLSID。 然後偵錯引擎必須登錄本身的 Visual Studio,以建立任何屬性 (否則也就是度量資訊) 的偵錯引擎支援。 寫入偵錯引擎的 Visual Studio 的登錄子機碼的矩陣方式的選擇取決於偵錯引擎所支援的功能。

SDK 的協助程式進行偵錯告訴您,不僅登錄位置所需登錄偵錯引擎。 此外,本文也將說明 dbgmetric.lib 程式庫,其中包含一些好用的函式和 c + + 開發人員,讓管理更容易登錄的宣告。

範例

下面是典型的範例 (從 TextInterpreter 範例) 顯示如何使用SetMetric Visual Studio 註冊偵錯引擎函式 (來自 dbgmetric.lib)。 傳入的度量資訊也會定義在 dbgmetric.lib 中。

注意事項注意事項

TextInterpreter 是基本偵錯引擎。 未實作,因此不會登錄及 — 任何其他功能。更完整的偵錯引擎會有一整份SetMetric的呼叫或其對等用法,另一個則用於偵錯引擎的每一項功能支援。

// Define base registry subkey to Visual Studio.
static const WCHAR strRegistrationRoot[] = L"Software\\Microsoft\\VisualStudio\\8.0";

HRESULT CTextInterpreterModule::RegisterServer(BOOL bRegTypeLib, const CLSID * pCLSID)
{
    SetMetric(metrictypeEngine, __uuidof(Engine), metricName, L"Text File", false, strRegistrationRoot);
    SetMetric(metrictypeEngine, __uuidof(Engine), metricCLSID, CLSID_Engine, false, strRegistrationRoot);
    SetMetric(metrictypeEngine, __uuidof(Engine), metricProgramProvider, CLSID_MsProgramProvider, false, strRegistrationRoot);
   
    return base::RegisterServer(bRegTypeLib, pCLSID);
}

請參閱

參考

SDK 的協助程式進行偵錯

其他資源

建立自訂偵錯引擎

Tutorial: Building a Debug Engine Using ATL COM