msgs12.hlp (Topic list)
MLM_QUERYSEL (1.2)
Message Group  Overview                           Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINMLE
 
MLM_QUERYSEL
mp1 = MPFROMSHORT(usQueryMode);    /* specifies the type of query */
mp2 = 0L;                          /* not used, must be zero      */
 
An application sends an MLM_QUERYSEL message to retrieve the offsets (number
of characters from the beginning of the text) of the characters selected in
a multiple-line entry field (MLE).
 
Parameter    Description
────────────────────────────────────────────────────────────────────────────
 
usQueryMode  Low word of mp1. Specifies which offset to return. This
             parameter can be one of the following values:
 
             Value            Meaning
             ───────────────────────────────────────────────────────────────
             MLFQS_MINMAXSEL  Returns the offsets of the selection in a
                              single 32-bit value. The high word contains
                              the offset of the ending selection character,
                              and the low word will contain the offset of
                              the beginning character. These values are
                              invalid if the selection contains offsets
                              greater than 64K.
 
             MLFQS_MINSEL     Returns the minimum (leftmost) offset of the
                              selection.
 
             MLFQS_MAXSEL     Returns the maximum (rightmost) offset of the
                              selection.
 
             MLFQS_ANCHORSEL  Returns the offset of the first selected
                              character.
 
             MLFQS_CURSORSEL  Returns the offset of the cursor.
 
Return Value
 
The return value is a 32-bit value; its meaning depends on the setting of
the usQueryMode parameter.
 
Example
 
This example sends two MLM_QUERYSEL messages to obtain the beginning and
ending points of the current selection, sends an MLM_SETIMPORTEXPORT message
to set up the export buffer, and then sends an MLM_EXPORT message to export
the selection into the buffer.
 
LONG lStart, cch;
CHAR szBuf[500];
 
lStart = (LONG) WinSendMsg(hwndMle, MLM_QUERYSEL,
    (MPARAM) MLFQS_MINSEL, (MPARAM) 0L);
cch = lStart - (LONG) WinSendMsg(hwndMle, MLM_QUERYSEL,
    (MPARAM) MLFQS_MAXSEL, (MPARAM) 0L);
WinSendMsg(hwndMle, MLM_SETIMPORTEXPORT,
    (MPARAM) szBuf, (MPARAM) sizeof(szBuf));
WinSendMsg(hwndMle, MLM_EXPORT, (MPARAM) &lStart, (MPARAM) &cch);
 
See Also
 
MLM_EXPORT, MLM_QUERYSELTEXT, MLM_SETIMPORTEXPORT, MLM_SETSEL