Hide

SftTree/DLL 7.5 - Tree Control

Display
Print

FindStringExact

Searches a string.

C

int SftTree_FindStringColExact(HWND hwndCtl,
      int index,
      int realCol,
      LPCTSTR lpszText);
int SftTree_FindStringExact(HWND hwndCtl, int index, LPCTSTR lpszText);
int WINAPI SftTree_FindStringExact_A(HWND hwndCtl, int index, LPCSTR lpszText);
int WINAPI SftTree_FindStringExact_W(HWND hwndCtl, int index, LPCWSTR lpszText);
int SftTreeSplit_FindStringColExact(HWND hwndCtl,
      int index,
      int realCol,
      LPCTSTR lpszText);
int SftTreeSplit_FindStringExact(HWND hwndCtl, int index, LPCTSTR lpszText);
int WINAPI SftTreeSplit_FindStringExact_A(HWND hwndCtl, int index, LPCSTR lpszText);
int WINAPI SftTreeSplit_FindStringExact_W(HWND hwndCtl, int index, LPCWSTR lpszText);

C++

int CSftTree::FindStringExact(int index, int realCol, CString& string) const;
int CSftTree::FindStringExact(int index, CString& string) const;
int CSftTree::FindStringExact(int index, int realCol, LPCTSTR lpszText) const;
int CSftTree::FindStringExact(int index, LPCTSTR lpszText) const;
int CSftTreeSplit::FindStringExact(int index, int realCol, CString& string) const;
int CSftTreeSplit::FindStringExact(int index, CString& string) const;
int CSftTreeSplit::FindStringExact(int index, int realCol, LPCTSTR lpszText) const;
int CSftTreeSplit::FindStringExact(int index, LPCTSTR lpszText) const;

Parameters

hwndCtl

The window handle of the tree control.

index

The zero-based index of the item where the search for the specified string is to begin.

realCol

The zero-based column number to be searched.

lpszText

The string to be searched.

string

The string to be searched.

Returns

The return value is the zero-based index of the item where the string was found. -1 is returned if the string was not found or an error occurred.

Comments

The FindStringExact function searches a string.

The column text searched is based on the column specified using realCol or last defined using SetAccessColumn. Functions, which do not allow the realCol parameter, access the column last defined by SetAccessColumn or the last column referenced by a column specific function. The last column accessed can be retrieved using GetAccessColumn.

The string lpszString is compared to the value returned by GetText for each item starting at index. The search starts at the item described by index and is restricted to the column specified by realCol. If an item with exactly matching text is found, its zero-based index is returned, otherwise -1 is returned.

Only one column can be searched at a time. The comparison of lpszString and the cell text is not case sensitive. If the cell text is identical to the string in lpszString, it is considered a match. To find a loose match for lpszString use FindString.

The FindStringEx function can also be used and allows additional search options.

SearchStringCell TextMatchComment
ABCabcYesSame string, case is ignored
abcabc123NoNot the same string
abcThisabcNoNot the same string
abcabNoNot the same string

See Also C/C++ API | Categories | Notifications