IDebugPendingBreakpoint2::EnumBoundBreakpoints
枚举从此挂起断点绑定的所有断点。
语法
参数
ppEnum
[out]返回枚举 绑定断点的 IEnumDebugBoundBreakpoints2 对象。
返回值
如果成功,则返回 S_OK
;否则,返回错误代码。 返回 E_BP_DELETED
是否已删除断点。
示例
以下示例演示如何为公开 IDebugPendingBreakpoint2 接口的简单CPendingBreakpoint
对象实现此方法。
HRESULT CPendingBreakpoint::EnumBoundBreakpoints(IEnumDebugBoundBreakpoints2** ppEnum)
{
HRESULT hr;
// Verify that the passed IEnumDebugBoundBreakpoints2 interface pointer
// is valid.
if (ppEnum)
{
*ppEnum = NULL;
// Verify that the pending breakpoint has not been deleted. If
// deleted, then return hr = E_BP_DELETED.
if (m_state.state != PBPS_DELETED)
{
// If the bound breakpoint member variable is valid.
if (m_pBoundBP)
{
// Get the bound breakpoint.
CComPtr<IDebugBoundBreakpoint2> spBoundBP;
hr = m_pBoundBP->QueryInterface(&spBoundBP);
assert(hr == S_OK);
if (hr == S_OK)
{
// Create the bound breakpoint enumerator.
CComObject<CEnumDebugBoundBreakpoints>* pBoundEnum;
hr = CComObject<CEnumDebugBoundBreakpoints>::CreateInstance(&pBoundEnum);
assert(hr == S_OK);
if (hr == S_OK)
{
// Initialize the enumerator of bound breakpoints with
// the IDebugBoundBreakpoint2 information.
IDebugBoundBreakpoint2* rgBoundBP[] = { spBoundBP.p };
hr = pBoundEnum->Init(rgBoundBP, &(rgBoundBP[1]), NULL, AtlFlagCopy);
if (hr == S_OK)
{
// Verify that the passed IEnumDebugBoundBreakpoints2
// interface can be queried by the created
// CEnumDebugBoundBreakpoints object.
hr = pBoundEnum->QueryInterface(ppEnum);
assert(hr == S_OK);
}
// Otherwise, delete the CEnumDebugBoundBreakpoints object.
if (FAILED(hr))
{
delete pBoundEnum;
}
}
}
}
else
{
hr = S_FALSE;
}
}
else
{
hr = E_BP_DELETED;
}
}
else
{
hr = E_INVALIDARG;
}
return hr;
}