This message searches the MLE text for a specified string, starting at a specified insertion point and continuing until the second specified insertion point has been reached, or the requested string has been matched.

When an MLM_SEARCH message is sent, the text is scanned starting with the character that follows the insertion point indicated in the iptStart field of the MLE_SEARCHDATA structure. The search proceeds until the point indicated in the iptStop field, until a match is found, or until TRUE is returned from MLN_SEARCHPAUSE notification (see WM_CONTROL (in Multiline Entry Fields)). If a negative value is specified for the iptStart, the current cursor point is used. If a negative value is specified for iptStop, the end of the text is used. If iptStop, is less than or equal to iptStart, after performing the two indicated substitutions, the search wraps from the end of the text to the beginning of the text.

If the MLFSEARCH_CASESENSITIVE option is specified, the bytes of the search string must exactly match those in the text. If MLFSEARCH_CASESENSITIVE is not specified, the WinUpperChar of the search string must match the WinUpperChar of the text.

When a match is found, the iptStart field of the search specification structure is set to indicate the insertion point immediately preceding the first character of the match, and the cchFind field is set to indicate the number of characters in the match. The cursor selection is not altered unless MLFSEARCH_SELECTMATCH is specified. If it is, an MLM_SETSEL is done with the anchor point at iptStart and the cursor at iptStart + cchFind.

While searching, the MLE occasionally sends an MLN_SEARCHPAUSE notification message. If the owner responds to this message with the value TRUE, the MLE stops the search. When a search is stopped from MLN_SEARCHPAUSE, iptStart is set to the point where the search terminated. If the response is FALSE, the search continues (see also the definition of MLN_SEARCHPAUSE). The interval at which MLN_SEARCHPAUSE notifications are sent is implementation-dependent, but must not exceed reasonable user-response thresholds, nor should it be so often as to introduce undue messaging overhead. Sending this notification every half second is a reasonable compromise.

When no match is found the iptStart value is unchanged.

If the application needs to continue the search, the proper way is to change the iptStart value to be the point following the string found, adjusting for any text changes done after the search that may have moved the relative location of the point.

Applications using this message are advised to change the system pointer to the wait icon (clock face) if it is expected that the search will take some time.


[Back] [Next]