我要通过Item中某一列的值来删除该行.请高手帮忙!!!

解决方案 »

  1.   

    int FindItem( LVFINDINFO* pFindInfo, int nStart = -1 ) const;
      

  2.   


    // The pointer to my list view control.
    extern CListCtrl* pmyListCtrl;
    // The string to match.
    extern LPCTSTR lpszmyString;LVFINDINFO info;
    int nIndex;info.flags = LVFI_PARTIAL|LVFI_STRING;
    info.psz = lpszmyString;// Delete all of the items that begin with the string lpszmyString.
    while ((nIndex=pmyListCtrl->FindItem(&info)) != -1)
    {
       pmyListCtrl->DeleteItem(nIndex);
    }
      

  3.   

    MSDN上的例子实在是看不懂,还有我对LVFINDINFO的参数搞不清楚用法.能不能有个更具体的例子并注明用法..谢谢了..
      

  4.   

    Contains information used when searching for a list-view item. This structure is identical to LVFINDINFO but has been renamed to fit standard naming conventions. Syntaxtypedef struct tagLVFINDINFO {
        UINT flags;
        LPCTSTR psz;
        LPARAM lParam;
        POINT pt;
        UINT vkDirection;
    } LVFINDINFO, *LPFINDINFO;
    Membersflags
    Type of search to perform. This member can be set to one or more of the following values: 
    LVFI_PARAM
    Searches for a match between this structure's lParam member and the lParam member of an item's LVITEM structure. If LVFI_PARAM is specified, all other flags are ignored.
    LVFI_PARTIAL
    Checks to see if the item text begins with the string pointed to by the psz member. This value implies use of LVFI_STRING.
    LVFI_STRING
    Searches based on the item text. Unless additional values are specified, the item text of the matching item must exactly match the string pointed to by the psz member. However, the search is case-insensitive.
    LVFI_WRAP
    Continues the search at the beginning if no match is found.
    LVFI_NEARESTXY
    Finds the item nearest to the position specified in the pt member, in the direction specified by the vkDirection member. This flag is supported only by large icon and small icon modes. 
    psz
    Address of a null-terminated string to compare with the item text. It is valid only if LVFI_STRING or LVFI_PARTIAL is set in the flags member. 
    lParam
    Value to compare with the lParam member of a list-view item's LVITEM structure. It is valid only if LVFI_PARAM is set in the flags member. 
    pt
    POINT structure with the initial search position. It is valid only if LVFI_NEARESTXY is set in the flags member. 
    vkDirection
    Virtual key code that specifies the direction to search. The following codes are supported: 
    VK_LEFT 
    VK_RIGHT 
    VK_UP 
    VK_DOWN 
    VK_HOME 
    VK_END 
    VK_PRIOR 
    VK_NEXT 
    This member is valid only if LVFI_NEARESTXY is set in the flags member. 
      

  5.   

    CListCtrl::FindItemint FindItem(LVFINDFO* pFindInfo,int nStart = -1) const返回值:如果成功,则返回项的索引值,否则为-1。参数: pFindInfo 一个指向包含被搜索项有关信息的LVFINDFO结构的指针。  
    nStart 搜索开始项的索引值。如果等于-1, 则从头进行搜索。否则,那么第nStart项包括在搜索范围内。  说明:
    使用该函数来搜索列表视图项中是否含有指定的字符。
    参数pFindInfo指向一个包含用于搜索列表视图项信息的LVFINDFO结构。
    CListCtrl::DeleteColumnBOOL DeleteColumn (int nCol)返回值:如果成功,则返回非零值,否则为0。参数: nCol 将要被删除列的索引值。  说明:调用该函数,从列表视图控件中删除某一列。