IDebugPendingBreakpoint2::EnumErrorBreakpoints
如需 Visual Studio 2017 的最新文件請參閱 Visual Studio 2017 文件。
取得此暫止中斷點所產生的所有錯誤中斷點的清單。
語法
HRESULT EnumErrorBreakpoints(
BP_ERROR_TYPE bpErrorType,
IEnumDebugErrorBreakpoints2** ppEnum
);
int EnumErrorBreakpoints(
enum_BP_ERROR_TYPE bpErrorType,
out IEnumDebugErrorBreakpoints2 ppEnum
);
參數
bpErrorType
[in]從值的組合BP_ERROR_TYPE選取要列舉的錯誤類型的列舉型別。
ppEnum
[out]傳回IEnumDebugErrorBreakpoints2物件,其中包含一份IDebugErrorBreakpoint2物件。
傳回值
如果成功,傳回S_OK
; 否則傳回錯誤碼。 傳回E_BP_DELETED
若已刪除中斷點。
範例
下列範例示範如何實作這種簡單的方式CPendingBreakpoint
公開物件IDebugPendingBreakpoint2介面。
HRESULT CPendingBreakpoint::EnumErrorBreakpoints(
BP_ERROR_TYPE bpErrorType,
IEnumDebugErrorBreakpoints2** ppEnum)
{
HRESULT hr;
// Verify that the passed IEnumDebugErrorBreakpoints2 interface pointer
// is valid.
if (ppEnum)
{
// Verify that the pending breakpoint has not been deleted. If
// deleted, then return hr = E_BP_DELETED.
if (m_state.state != PBPS_DELETED)
{
// Verify that this error is not a warning.
// All errors supported by this DE are errors, not warnings.
if (IsFlagSet(bpErrorType, BPET_TYPE_ERROR) && m_pErrorBP)
{
// Get the error breakpoint.
CComPtr<IDebugErrorBreakpoint2> spErrorBP;
hr = m_pErrorBP->QueryInterface(&spErrorBP);
assert(hr == S_OK);
if (hr == S_OK)
{
// Create the error breakpoint enumerator.
CComObject<CEnumDebugErrorBreakpoints>* pErrorEnum;
hr = CComObject<CEnumDebugErrorBreakpoints>::CreateInstance(&pErrorEnum);
assert(hr == S_OK);
if (hr == S_OK)
{
// Initialize the enumerator of error breakpoints with
// the IDebugErrorBreakpoint2 information.
IDebugErrorBreakpoint2* rgpErrorBP[] = { spErrorBP.p };
hr = pErrorEnum->Init(rgpErrorBP, &(rgpErrorBP[1]), NULL, AtlFlagCopy);
if (hr == S_OK)
{
// Verify that the passed IEnumDebugErrorBreakpoints2
// interface can be queried by the created
// CEnumDebugErrorBreakpoints object.
hr = pErrorEnum->QueryInterface(ppEnum);
assert(hr == S_OK);
}
// Otherwise, delete the CEnumDebugErrorBreakpoints
// object.
if (FAILED(hr))
{
delete pErrorEnum;
}
}
}
}
else
{
hr = S_FALSE;
}
}
else
{
hr = E_BP_DELETED;
}
}
else
{
hr = E_INVALIDARG;
}
return hr;
}
另請參閱
IDebugPendingBreakpoint2
BP_ERROR_TYPE
IEnumDebugErrorBreakpoints2
IDebugErrorBreakpoint2