IDebugPendingBreakpoint2::Virtualize
如需 Visual Studio 2017 的最新文件請參閱 Visual Studio 2017 文件。
切換這個暫止中斷點的虛擬化的狀態。 當虛擬化暫止中斷點時,偵錯引擎會嘗試將它繫結,每次新的程式碼載入程式。
語法
HRESULT Virtualize(
BOOL fVirtualize
);
int Virtualize(
int fVirtualize
);
參數
fVirtualize
[in]設定為非零 (TRUE
) 虛擬化暫止中斷點,或為零 (FALSE
) 若要關閉虛擬化。
傳回值
如果成功,傳回S_OK
; 否則傳回錯誤碼。 傳回E_BP_DELETED
若已刪除中斷點。
備註
虛擬化的中斷點會繫結,每次載入的程式碼。
範例
下列範例示範如何實作這種簡單的方式CPendingBreakpoint
公開物件IDebugPendingBreakpoint2介面。
HRESULT CPendingBreakpoint::Virtualize(BOOL fVirtualize)
{
HRESULT hr;
// Verify that the pending breakpoint has not been deleted. If deleted,
// then return hr = E_BP_DELETED.
if (m_state.state != PBPS_DELETED)
{
if (fVirtualize)
{
// Set the PBPSF_VIRTUALIZED flag in the PENDING_BP_STATE_FLAGS
// structure.
SetFlag(m_state.flags, PBPSF_VIRTUALIZED);
}
else
{
// Clear the PBPSF_VIRTUALIZED flag in the PENDING_BP_STATE_FLAGS
// structure.
ClearFlag(m_state.flags, PBPSF_VIRTUALIZED);
}
hr = S_OK;
}
else
{
hr = E_BP_DELETED;
}
return hr;
}