Compartilhar via


CListBox::FindStringExact

Finds the first list-box string that matches the string specified in lpszFind.

int FindStringExact( 
   int nIndexStart, 
   LPCTSTR lpszFind  
) const;

Parameters

  • nIndexStart
    Specifies the zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by nIndexStart. If nIndexStart is –1, the entire list box is searched from the beginning.

  • lpszFind
    Points to the null-terminated string to search for. This string can contain a complete filename, including the extension. The search is not case sensitive, so the string can contain any combination of uppercase and lowercase letters.

Return Value

The index of the matching item, or LB_ERR if the search was unsuccessful.

Remarks

If the list box was created with an owner-draw style but without the LBS_HASSTRINGS style, the FindStringExact member function attempts to match the doubleword value against the value of lpszFind.

Example

// The string to match.
LPCTSTR lpszmyString = _T("item string 3");

// Delete all items that exactly match the specified string. 
int nIndex = 0;
while ((nIndex=m_myListBox.FindStringExact(nIndex, lpszmyString)) != LB_ERR)
{
   m_myListBox.DeleteString(nIndex);
}

Requirements

Header: afxwin.h

See Also

Reference

CListBox Class

Hierarchy Chart

CListBox::FindString

LB_FINDSTRING

LB_FINDSTRINGEXACT