WM CONTROL
Appearance
This message occurs when a control has a significant event to notify to its owner.
Syntax
param1 USHORT id /* Control-window identity. */ USHORT usnotifycode /* Notify code. */ param2 ULONG ulcontrolspec /* Notify control-specific information. */
- in Combination Boxes
param1 USHORT usid /* Control window identity. */ USHORT usnotifycode /* Notify code. */ param2 HWND hwndcontrolspec /* Combination (combo) window handle. */
- in Container Controls
For the cause of this message, see WM_CONTROL. param1 USHORT id /* Container control ID. */ USHORT notifycode /* Notify code. */ param2 ULONG notifyinfo /* Notify code information. */
- in Entry Fields
param1 USHORT id /* Control window identity. */ USHORT usnotifycode /* Notify code. */ param2 HWND hwndcontrolspec /* Entry field control window handle. */
- in List Boxes
param1 USHORT id /* Control-window identity. */ USHORT usnotifycode /* Notify code. */ param2 HWND hwndcontrolspec /* List box control window handle. */
- in Multiline Entry Fields
param1 USHORT usid /* Control window identity. */ USHORT usnotifycode /* Notify code. */ param2 ULONG ulOver /* Number of bytes that do not fit. */ PIX pixOver /* Linear distance of overflow in pels. */ POVERFLOW pErrInfo /* Overflow error information structure. */ ULONG ulErrInd /* Clipboard fail flag. */ PMARGSTRUCT pmrg /* Margin structure. */ IPT iptSearchedTo /* Current insertion point of search. */ ULONG ulReserved /* Reserved value, should be 0. */ returns BOOL rc /* Action taken by application. */ ULONG ulReserved /* Reserved value, should be 0. */
Parameters
Default
- id (USHORT)
- Control-window identity.
- This is either the parameter of the WinCreateWindow function or the identity of an item in a dialog template.
- usnotifycode (USHORT)
- Notify code.
- The meaning of the notify code depends on the type of the control. For details, refer to the section describing that control.
- CSN_SETFOCUS
- This code returns a Boolean indicating whether the circular slider control sending the notification message is gaining or losing the focus.
- param2 contains TRUE if the control is gaining the focus.
- CSN_CHANGED
- This code is sent to notify the application that the circular slider value has been changed.
- param2 contains the new value of the circular slider.
- CSN_TRACKING
- This code is sent to notify the application that the circular slider is being tracked by the mouse.
- param2 contain the inter-media value of the circular slider.
- Inter-media values are not necessarily contiguous.
- CSN_QUERYBACKGROUNDCOLOR
- This code gives the application the opportunity to set the background color of the circular slider. CLR_* or SYSCLR_* values can be returned for the background color.
- param2 is NULL.
- ulcontrolspec (ULONG)
- Control-specific information.
- The meaning of the control-specific information depends on the type of the control. For details, refer to the section describing that control.
in Combination Boxes
- usnotifycode (USHORT)
- Notify code.
CBN_EFCHANGE The content of the entry field control has changed, and the change has been displayed on the screen.
CBN_MEMERROR
The entry field control cannot allocate the storage necessary to accommodate window text of the length implied by the EM_SETTEXTLIMIT message.
CBN_EFSCROLL
The entry field control is about to scroll horizontally. This can happen in these circumstances:
The application has issued a WinScrollWindow call. The content of the entry field control has changed. The caret has moved. The entry field control must scroll to show the caret position.
CBN_LBSELECT
- An item in the list box control has been selected.
CBN_LBSCROLL
- The list box is about to scroll.
CBN_SHOWLIST
- The list box is about to be displayed.
CBN_ENTER
- The user has depressed the ENTER key or double clicked (single clicked in the case of a drop-down list) on an item in the list box control.
- hwndcontrolspec (HWND)
- Combination (combo) window handle.
in Container Controls
- id (USHORT)
- Container control ID.
- notifycode (USHORT)
- Notify code.
- The container control uses the following notification codes. For the complete description of the specified notifycode, see Container Control Notification Codes.
- CN_BEGINEDIT
Container text is about to be edited.
- CN_COLLAPSETREE
A parent item was collapsed in the tree view.
- CN_CONTEXTMENU
The container received a WM_CONTEXTMENU message.
- CN_DRAGAFTER
The container received a DM_DRAGOVER message. The CN_DRAGAFTER notification code is sent only if either the CA_ORDEREDTARGETEMPH or CA_MIXEDTARGETEMPH attribute of the CNRINFO data structure is set and the current view is the name, text, or details view.
- CN_DRAGLEAVE
The container received a DM_DRAGLEAVE message.
- CN_DRAGOVER
The container received a DM_DRAGOVER message. The CN_DRAGOVER notification code is sent only if the CA_ORDEREDTARGETEMPH attribute of the CNRINFO data structure is not set or the current view is the icon view or tree view.
- CN_DROP
The container received a DM_DROP message.
- CN_DROPNOTIFY
The container received a DM_DROPNOTIFY message.
- CN_DROPHELP
The container received a DM_DROPHELP message.
- CN_EMPHASIS
A container record's attributes changed.
- CN_ENDEDIT
Direct editing of container text has ended.
- CN_ENTER
The Enter key is pressed while the container window has the focus, or the select button is double-clicked while the pointer is over the container window.
- CN_EXPANDTREE
A parent item is expanded in the tree view.
- CN_GRIDRESIZED
The grid was resized. This means there are more or fewer squares than previously, and all the squares are now marked CM_AVAIL. CN_HELP The container received a WM_HELP message.
- CN_INITDRAG
The drag button was pressed and the pointer was moved while the pointer was over the container control.
- CN_KILLFOCUS
The container is losing the focus.
- CN_PICKUP
The container received a WM_PICKUP message.
- CN_QUERYDELTA
Queries for more data when a user scrolls to a preset delta value.
- CN_REALLOCPSZ
Container text is edited. This message is sent before the CN_ENDEDIT notification code is sent.
- CN_SCROLL
The container window scrolled.
- CN_SETFOCUS
The container is receiving the focus.
- notifyinfo (ULONG)
- Notify code information.
- For the definition of this parameter, see the description of the specified notifycode in Container Control Notification Codes.
in Entry Fields
- id (USHORT)
- Control window identity.
- usnotifycode (USHORT)
- Notify code.
- EN_CHANGE
The content of the entry field control has changed, and the change has been displayed on the screen.
- EN_KILLFOCUS
The entry field control is losing the focus.
- EN_MEMERROR
The entry field control cannot allocate the storage necessary to accommodate window text of the length implied by the EM_SETTEXTLIMIT message.
- EN_OVERFLOW
The entry field control cannot insert more text than the current text limit. The text limit may be changed with the EM_SETTEXTLIMIT message.
If the recipient of this message returns TRUE, then the entry field control retries the operation, otherwise it terminates the operation.
- EN_SCROLL
The entry field control is about to scroll horizontally. This can happen in these circumstances:
The application has issued a WinScrollWindow call � The content of the entry field control has changed � The caret has moved � The entry field control must scroll to show the caret position.
- EN_SETFOCUS
The entry field control is receiving the focus.
- hwndcontrolspec (HWND)
- Entry field control window handle.
in Multiline Entry Fields
- usid (USHORT)
- Control window identity.
- usnotifycode (USHORT)
- Notify code.
- MLN_TEXTOVERFLOW
A key stroke causes the amount of text to exceed the limit on the number of bytes of data (refer to MLM_SETTEXTLIMIT). The parameter contains the number of bytes of data which would not fit within the current text limit. For character key strokes this can be 1 or 2 (DBCS). For Shift+Ins (paste) it can be any amount up to the paste limit.
The default rc of FALSE causes the default error handling, which is to ignore the key stroke, and beep.
An rc of TRUE implies that corrective action has been taken (such as deleting existing text or raising the limit) and the WM_CHAR (in Multiline Entry Fields) should be reprocessed as if just entered.
- MLN_PIXHORZOVERFLOW
A key stroke causes the size of the display bit map to exceed the horizontal limit of the format rectangle (refer to MLM_SETFORMATRECT). The parameter contains the number of pels that would not fit within the current text limit.
The default rc of FALSE causes the default error handling, which is to ignore the key stroke, and beep.
An rc of TRUE implies that corrective action has been taken (such as changing to a smaller font or raising the limit) and the WM_CHAR (in Multiline Entry Fields) should be reprocessed as if just entered.
- MLN_PIXVERTOVERFLOW
A key stroke causes the size of the display bit map to exceed the vertical limit of the format rectangle (refer to MLM_SETFORMATRECT). The parameter contains the number of pels that would not fit within the current text limit.
The default rc of FALSE causes the default error handling, which is to ignore the key stroke, and beep.
An rc of TRUE implies that corrective action has been taken (such as changing to a smaller font or raising the limit) and the WM_CHAR (in Multiline Entry Fields) should be reprocessed as if just entered.
- MLN_OVERFLOW
An action other than entry of a key stroke causes a condition involving the text limit or format rectangle limit, such that either the limit becomes inadequate to contain the text or the text exceeds the limit.
This can be caused by:
MLM_SETWRAP MLM_SETTABSTOP MLM_SETFONT MLM_IMPORT MLM_PASTE MLM_CUT MLM_UNDO MLM_DELETE WM_SIZE.
- MLN_HSCROLL
Indicates that the MLE has completed a scrolling calculation and is about to update the display accordingly. All queries return values as if the scrolling were complete. However, no scrolling action is visible on the user interface.
- MLN_VSCROLL
Indicates that the MLE has completed a scrolling calculation and is about to update the display accordingly. All queries return values as if the scrolling were complete. However, no scrolling action is visible on the user interface.
- MLN_CHANGE
Signals that the text has changed. This notification is sent whenever any text change occurs.
- MLN_UNDOOVERFLOW
Signals that the text change operation, which could normally be undone, cannot be undone because the amount of text involved exceeds the undo capability. This includes text entry, deletion, cutting, and pasting.
- MLN_CLPBDFAIL
Signals that a clipboard operation failed.
- MLN_MEMERROR
Signals that the required storage cannot be obtained. The action that results in the increased storage requirement fails.
- MLN_SETFOCUS
Sent whenever the MLE window receives the input focus.
- MLN_KILLFOCUS
Sent whenever the MLE window loses the input focus.
- MLN_MARGIN
Whenever the user moves the mouse into the left, right top, or bottom margins, this message is sent to the owner of the window.
If the owner returns an rc of TRUE, the mouse move is assumed to have been processed by the owner and no further action need be taken.
If the owner returns an rc of FALSE, the MLE performs a default action appropriate to each different mouse action.
The exceptions to this are all mouse messages that occur after a button-down inside the margin, until and including the matching button-up. Conceptually the drag (button-down until button-up) is a single macro event. Therefore, if FALSE is returned for a button-down event, no further margin notifications are given until after the drag has ended (button-up).
Note: If the application receives a notification of button-down in the margin and processes it, it must capture the mouse until the button-up event.
- MLN_SEARCHPAUSE
This notification is sent periodically by the MLE, while an MLM_SEARCH message is being processed, to give an application the opportunity to stop excessively long searches, and to provide search progress information. The owner window can respond either with TRUE or FALSE. FALSE causes the MLE to continue searching; TRUE causes the MLE to stop the search immediately. For further information, see MLM_SEARCH
- ulOver (ULONG)
Number of bytes that do not fit.
param2 contains ulOver for a usnotifycode of MLN_TEXTOVERFLOW.
- pixOver (PIX)
Linear distance of overflow in pels.
param2 contains pixOver for a usnotifycode of MLN_PIXHORZOVERFLOW or MLN_PIXVERTOVERFLOW.
- pErrInfo (POVERFLOW)
Overflow error information structure.
param2 contains pErrInfo for a usnotifycode of MLN_OVERFLOW.
The afErrInd field of the MLEOVERFLOW structure can take one or more of the following values:
- MLFEFR_RESIZE
The window is resized, and the format rectangle is tied to the window size and limited either horizontally, vertically, or both. The implicit change of the format rectangle to the new size does not contain the text. The format rectangle is made static at the previous size, and the MLESFR_MATCHWINDOW style is turned off until set again by the application. This is done in response to a WM_SIZE message, and therefore the multi-line entry field does not forward the return value from this notification message.
- MLFEFR_TABSTOP
A tab stop location change is requested, and the text is limited either horizontally, vertically, or both. Changing the tab stops causes the text to exceed the limit. The tab stop change is rejected.
- MLFEFR_FONT
A font change is requested, and the text is limited either horizontally, vertically, or both. Changing the font causes the text to exceed the limit. The font change is rejected.
- MLFEFR_WORDWRAP
The word-wrap state is requested to be changed, and the text is limited either horizontally, vertically, or both. Wrapping the text differently exceeds the limit, and the request is rejected. This happens in situations where the horizontal limit is not set, there are lines exceeding it, and word-wrap is being changed from off to on, such that it creates soft line breaks resulting in increased vertical size. This happens if word-wrap is being changed from on to off, and there is at least one line created by a soft line-break, such that when that line-break is removed, the full line (up to the hard line break) exceeds the horizontal limit.
- MLFEFR_TEXT
Text is changed by MLM_IMPORT, MLM_PASTE, MLM_CUT, MLM_UNDO, or MLM_DELETE, and the text is limited either horizontally, vertically, or both within the format rectangle. The change causes the text to exceed the format rectangle in a dimension that is limited. For example, Delete and EOL joins text from two lines into one line long enough to exceed the horizontal limit.
- MLFETL_TEXTBYTES
Text is changed by MLM_IMPORT MLM_PASTE, or MLM_UNDO, and the text is limited to a maximum number of bytes. The change causes the text to exceed that maximum.
- ulErrInd (ULONG)
Clipboard fail flag.
param2 contains ulErrInd for a usnotifycode of MLN_CLPBDFAIL.
- MLFCPBD_TOOMUCHTEXT
Text amount exceeds clipboard capacity
- MLFCPBD_CLPBDERROR
A clipboard error occurred.
- pmrg (PMARGSTRUCT)
Margin structure.
param2 contains pmrg for a usnotifycode of MLN_MARGIN.
The left and right margins are defined as going all the way to the top and bottom such that the top and bottom margins are contained between them. Therefore, the corners are included in the sides.
usMouMsg contains the mouse message that signals the event.
iptNear contains the insertion point of the nearest point in the text. For situations where the nearest location is beyond the end of a line, the insertion point for the end of the line is returned. (The EOL character is considered to be beyond the end of the line.)
- iptSearchedTo (IPT)
Current insertion point of search.
param2 contains iptSearchedTo for a usnotifycode of MLN_SEARCHPAUSE.
- ulReserved (ULONG)
Reserved value, should be 0.
param2 contains ulReserved for a usnotifycode of MLN_HSCROLL, MLN_VSCROLL, MLN_CHANGE, MLN_UNDOOVERFLOW, MLN_MEMERROR, MLN_SETFOCUS, or MLN_KILLFOCUS.
- rc (BOOL)
Action taken by application.
ReturnCode contains rc for a usnotifycode of MLN_TEXTOVERFLOW, MLN_PIXHORZOVERFLOW, MLN_PIXVERTOVERFLOW, MLN_MARGIN, or MLN_SEARCHPAUSE.
- TRUE
- The multiline entry field control assumes that appropriate action has been taken by the application. Appropriate action depends on the MLN_* notification code, and is documented under the usnotifycode field.
- FALSE
- The multiline entry field control assumes that the application has ignored this WM_CONTROL (in Multiline Entry Fields) message, and takes action appropriate to the MLN_* notification code, as documented under the usnotifycode field.
- ulReserved (ULONG)
Reserved value, should be 0.
ReturnCode contains ulReserved for a usnotifycode of MLN_OVERFLOW, MLN_HSCROLL, MLN_VSCROLL, MLN_CHANGE, MLN_UNDOOVERFLOW, MLN_CLPBDFAIL, MLN_MEMERROR, MLN_SETFOCUS, or MLN_KILLFOCUS.
in List Boxes
- id (USHORT)
- Control-window identity.
- usnotifycode (USHORT)
- Notify code.
- The list box control window procedure uses these notification codes:
- LN_ENTER
Either the Enter or Return key has been pressed while the list box control has the focus, or the list box control has been double-clicked.
- LN_KILLFOCUS
The list box control loses the focus.
- LN_SCROLL
The list box control is about to scroll horizontally. This can happen when the application has issued a WinScrollWindow function.
- LN_SETFOCUS
The list box control receives the focus.
- LN_SELECT
An item is being selected (or deselected).
Note: To discover the index of the selected item, the application must use the LM_QUERYSELECTION message.
- hwndcontrolspec (HWND)
- List box control window handle.
Returns
- ulReserved (ULONG)
- Reserved value, should be 0.
Remarks
This message is sent to the owner of the control, thereby offering it the opportunity to perform some activity before returning to the control.
- in Circular Slider Controls
- The circular slider control window procedure generates this message and sends it to its owner, informing the owner of this event.
- in Combination Boxes
- The entry field control window procedure generates this message and sends it to its owner, informing the owner of the event.
- in Container Controls
- The container control window procedure generates this message and sends it to its owner, informing the owner of this event.
- in Entry Fields
- The entry field control window procedure generates this message and sends it to its owner, informing the owner of the event.
- in Language Support Dialog
- The Language Support Dialog Procedure responds to this message by issuing the WinDefDlgProc function, then posting a WM_PCONTROL message to the application queue and setting ulReserved to the result of the WinDefDlgProc function.
- in Language Support Window
- The Language Support Window Procedure responds to this message by posting a WM_PCONTROL message to the application queue and setting ulReserved to 0.
- in List Boxes
- The list box control window procedure generates this message and sends it to its owner, informing the owner of this event.
Default Processing
The default window procedure takes no action on this message, other than to set ulReserved to 0.