msgs12.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
MLM_SEARCH (1.2)
Message Group  Overview                           Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINMLE
 
MLM_SEARCH
mp1 = MPFROMLONG(ulStyle);  /* search style                          */
mp2 = MPFROMP(pmlesearch);  /* address of structure with search data */
 
An application sends an MLM_SEARCH message to search for (and optionally
replace) text within a multiple-line entry field (MLE).
 
Parameter   Description
────────────────────────────────────────────────────────────────────────────
 
ulStyle     Low and high word of mp1. Specifies the style of the search.
            This parameter can be any combination of the following values:
 
            Value                    Meaning
            ────────────────────────────────────────────────────────────────
            MLFSEARCH_CASESENSITIVE  Specifies that the search is
                                     case-sensitive.
 
            MLFSEARCH_SELECTMATCH    Specifies that if the text is found, it
                                     should be highlighted and scrolled into
                                     view (if necessary). This is identical
                                     to sending the MLM_SETSEL message.
 
            MLFSEARCH_CHANGEALL      Specifies that all text found is to be
                                     replaced by the text in the pchReplace
                                     field of the MLE_SEARCHDATA structure.
 
pmlesearch  Low and high word of mp2. Points to the MLE_SEARCHDATA structure
            that contains the search data.
 
Return Value
 
The return value is TRUE if the search is successful, or it is FALSE,
indicating that the search string was not found.
 
Comments
 
If the MLFSEARCH_CHANGEALL flag is not set and a match is found, the
iptStart field of the MLE_SEARCHDATA structure is set to the offset (number
of characters from the beginning of the text) of the first character that
matches the search string. The cchFound field is set to the number of
characters that match the search string. The current cursor position is not
changed unless the MLFSEARCH_SELECTMATCH flag is set.
 
While the MLE is searching, it periodically sends an MLN_SEARCHPAUSE message
that contains the current position of the search. You can terminate the
search by returning TRUE to the MLN_SEARCHPAUSE notification message.
 
Example
 
This example searches for all occurrences of the word bonnie and replaces it
with the word jeannette:
 
MLE_SEARCHDATA search;
search.cb = sizeof(search);
search.pchFind = "bonnie";
search.pchReplace = "jeannette";
search.cchFind = 6;
search.cchReplace = 9;
search.iptStart = 0;   /* from the beginning of the text */
search.iptStop = -1;   /* to the end of the text         */
WinSendMsg(hwndMle, MLM_SEARCH, MLFSEARCH_CHANGEALL, (MPARAM) &search);
 
See Also
 
MLM_SETSEL, MLN_SEARCHPAUSE, WM_CONTROL, MLE_SEARCHDATA