日期:2014-05-20  浏览次数:20982 次

关于Wab32的一个方法
这段代码执行的结果是DeleteEntries失败。我想把这个Wab文件里的联系人清空。请做过类似项目的人帮我。谢谢

C/C++ code

HRESULT CWAB::DeleteEntry()
{
    HRESULT hr = hrSuccess;
    ULONG cbWABEID = 0;
    LPENTRYID lpWABEID = NULL;
    LPABCONT lpWABCont = NULL;
    ULONG ulObjType;
    SBinaryArray SBA;

    hr = m_lpAdrBook->GetPAB( &cbWABEID, &lpWABEID);
    if(HR_FAILED(hr))
        goto out;

    hr = m_lpAdrBook->OpenEntry(cbWABEID, lpWABEID, NULL, 0, &ulObjType, (LPUNKNOWN *)&lpWABCont);

    if(HR_FAILED(hr))
        goto out;

    SBA.cValues = 1;
    SBA.lpbin = &m_SB;

    hr = lpWABCont->DeleteEntries((LPENTRYLIST) &SBA, 0);

    if(m_lpPropArray)
        m_lpWABObject->FreeBuffer(m_lpPropArray);

    m_lpPropArray = NULL;
    m_ulcValues = 0;

out:
    if(lpWABCont)
        lpWABCont->Release();

    if(lpWABEID)
        m_lpWABObject->FreeBuffer(lpWABEID);

    return hr;
}





------解决方案--------------------
单步调试,检测异常
------解决方案--------------------
C++不太懂