请给一个sample

解决方案 »

  1.   

    insert a element at special position ... ...typedef CTypedPtrList<CPtrList, CYourObject*> CYourObjectList;
    CYourObjectList list;
    CYourObject *pOb, *pInsetOb;
    POSITION preps, ps = list.GetHeadPosition();
    while(ps)
    {
    preps = ps;
    pOb= list.GetNext(ps);
    if(Your Condition)
    {
    pInsetOb = new CYourObject ;
    if(!preps)
    preps = ChanList.GetTailPosition();
    list.InsertBefore(preps, pInsetOb);
    return TRUE;
    }
    }
      

  2.   

    HRESULT insertBefore(
        IXMLDOMNode *newChild,
        VARIANT refChild,
        IXMLDOMNode **outNewChild);
    函数是这样,主要是第二个参数