 BM_CLICK

An application sends a BM_CLICK message to simulate the user clicking a button. This message causes the button to receive a WM_LBUTTONDOWN and a WM_LBUTTONUP message, and the button's parent window to receive a BN_CLICKED notification message.

BM_CLICK

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

This message does not return a value.

See Also

BN_CLICKED, WM_LBUTTONDOWN, WM_LBUTTONUP


 BM_GETCHECK

An application sends a BM_GETCHECK message to retrieve the check state of a radio button or check box.

BM_GETCHECK

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value from a button created with the BS_AUTOCHECKBOX, BS_AUTORADIOBUTTON, BS_AUTO3STATE, BS_CHECKBOX, BS_RADIOBUTTON, or BS_3STATE style can be one of the following:

Value | Meaning
BST_CHECKED | Button is checked.
BST_INDETERMINATE | Button is grayed, indicating an indeterminate state (applies only if the button has the BS_3STATE or BS_AUTO3STATE style).
BST_UNCHECKED | Button is unchecked

If the button has any other style, the return value is zero.

See Also

BM_GETSTATE, BM_SETCHECK


 BM_GETIMAGE

An application sends a BM_GETIMAGE message to retrieve the handle of the image (icon or bitmap) associated with the button.

BM_GETIMAGE

wParam = (WPARAM) fImageType; // image-type flag

lParam = 0; // not used, must be zero

Parameters

fImageType

Value of wParam. Specifies the type of image to associate with the button. This parameter can be one of the following values:

IMAGE_BITMAP
IMAGE_ICON

Return Values

The return value is the handle of the image, if any; otherwise, it is NULL.

See Also

BM_SETIMAGE


 BM_GETSTATE

An application sends a BM_GETSTATE message to determine the state of a button or check box.

BM_GETSTATE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value specifies the current state of the button. You can use the following bitmasks to extract information about the state:

Value | Meaning
0x0003 | Specifies the check state (radio buttons and check boxes only). A value of BST_UNCHECKED indicates the button is unchecked; a value of BST_CHECKED indicates the button is checked. A radio button is checked when it contains a dot; a check box is checked when it contains an X. A value of BST_INDETERMINATE indicates the check state is indeterminate (applies only if the button has the BS_3STATE or BS_AUTO3STATE style). A three-state check box is grayed when its state is indeterminate.
BST_CHECKED | Indicates the button is checked.
BST_FOCUS | Specifies the focus state. A nonzero value indicates that the button has the keyboard focus.
BST_INDETERMINATE | Indicates the button is grayed because the state of the button is indeterminate. This value applies only if the button has the BS_3STATE or BS_AUTO3STATE style.
BST_PUSHED | Specifies the highlight state. A nonzero value indicates that the button is highlighted. A button is automatically highlighted when the user positions the cursor over it and presses and holds the left mouse button. The highlighting is removed when the user releases the mouse button.
BST_UNCHECKED | Indicates the button is unchecked. Same as the Windows NT return value of zero.

See Also

BM_GETCHECK, BM_SETSTATE


 BM_SETCHECK

An application sends a BM_SETCHECK message to set the check state of a radio button or check box.

BM_SETCHECK

wParam = (WPARAM) fCheck; // check state

lParam = 0; // not used; must be zero

Parameters

fCheck

Value of wParam. Specifies the check state. This parameter can be one of the following values:

Value | Meaning
BST_CHECKED | Sets the button state to checked.
BST_INDETERMINATE | Sets the button state to grayed, indicating an indeterminate state. Use this value only if the button has the BS_3STATE or BS_AUTO3STATE style.
BST_UNCHECKED | Sets the button state to unchecked

Return Values

This message always returns zero.

Remarks

The BM_SETCHECK message has no effect on push buttons.

See Also

BM_GETCHECK, BM_GETSTATE, BM_SETSTATE


 BM_SETIMAGE

An application sends a BM_SETIMAGE message to associate a new image (icon or bitmap) with the button.

BM_SETIMAGE

wParam = (WPARAM) fImageType; // image-type flag

lParam = (LPARAM) (HANDLE) hImage; // handle of the image

Parameters

fImageType

Value of wParam. Specifies the type of image to associate with the button. This parameter can be one of the following values:

IMAGE_BITMAP
IMAGE_ICON

hImage

Value of lParam. Identifies the image to associate with the button.

Return Values

The return value is the handle of the image previously associated with the button, if any; otherwise, it is NULL.

See Also

BM_GETIMAGE


 BM_SETSTATE

An application sends a BM_SETSTATE message to change the highlight state of a button. The highlight state indicates whether the button is highlighted as if the user had pushed it.

BM_SETSTATE

wParam = (WPARAM) fState; // highlight state

lParam = 0; // not used; must be zero

Parameters

fState

Value of wParam. Specifies whether the button is to be highlighted. A value of TRUE highlights the button. A value of FALSE removes any highlighting.

Return Values

This message always returns zero.

Remarks

Highlighting only affects the appearance of a button. It has no effect on the check state of a radio button or check box.

A button is automatically highlighted when the user positions the cursor over it and presses and holds the left mouse button. The highlighting is removed when the user releases the mouse button.

See Also

BM_GETSTATE, BM_SETCHECK


 BM_SETSTYLE

An application sends a BM_SETSTYLE message to change the style of a button.

BM_SETSTYLE

wParam = (WPARAM) LOWORD(dwStyle); // style

lParam = MAKELPARAM(fRedraw, 0); // redraw flag

Parameters

dwStyle

Value of wParam. Specifies the button style. For an explanation of button styles, see the following Remarks section.

fRedraw

Value of the low-order word of lParam. Specifies whether the button is to be redrawn. A value of TRUE redraws the button; a value of FALSE does not redraw the button.

Return Values

This message always returns zero.

Remarks

Following are the available button styles:

Style | Meaning
BS_3STATE | Creates a button that is the same as a check box, except that the box can be grayed as well as checked or unchecked. Use the grayed state to show that the state of the check box is not determined.
BS_AUTO3STATE | Creates a button that is the same as a three-state check box, except that the box changes its state when the user selects it. The state cycles through checked, grayed, and unchecked.
BS_AUTOCHECKBOX | Creates a button that is the same as a check box, except that the check state automatically toggles between checked and unchecked each time the user selects the check box.
BS_AUTORADIOBUTTON | Creates a button that is the same as a radio button, except that when the user selects it, Windows automatically sets the button's check state to checked and automatically sets the check state for all other buttons in the same group to unchecked.
BS_CHECKBOX | Creates a small, empty check box with text. By default, the text is displayed to the right of the check box. To display the text to the left of the check box, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style).
BS_DEFPUSHBUTTON | Creates a push button that behaves like a BS_PUSHBUTTON style button, but also has a heavy black border. If the button is in a dialog box, the user can select the button by pressing the ENTER key, even when the button does not have the input focus. This style is useful for enabling the user to quickly select the most likely (default) option.
BS_GROUPBOX | Creates a rectangle in which other controls can be grouped. Any text associated with this style is displayed in the rectangle's upper left corner.
BS_LEFTTEXT | Places text on the left side of the radio button or check box when combined with a radio button or check box style. Same as the BS_RIGHTBUTTON style.
BS_OWNERDRAW | Creates an owner-drawn button. The owner window receives a WM_MEASUREITEM message when the button is created and a WM_DRAWITEM message when a visual aspect of the button has changed. Do not combine the BS_OWNERDRAW style with any other button styles.
BS_PUSHBUTTON | Creates a push button that posts a WM_COMMAND message to the owner window when the user selects the button.
BS_RADIOBUTTON | Creates a small circle with text. By default, the text is displayed to the right of the circle. To display the text to the left of the circle, combine this flag with the BS_LEFTTEXT style (or with the equivalent BS_RIGHTBUTTON style). Use radio buttons for groups of related, but mutually exclusive choices.
BS_USERBUTTON | Obsolete, but provided for compatibility with 16-bit versions of Windows. Win32-based applications should use BS_OWNERDRAW instead.
BS_BITMAP | Specifies that the button displays a bitmap.
BS_BOTTOM | Places text at the bottom of the button rectangle.
BS_CENTER | Centers text horizontally in the button rectangle.
BS_ICON | Specifies that the button displays an icon.
BS_LEFT | Left-justifies the text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is left justified on the right side of the check box or radio button.
BS_MULTILINE | Wraps the button text to multiple lines if the text string is too long to fit on a single line in the button rectangle.
BS_NOTIFY | Enables a button to send BN_DBLCLK, BN_KILLFOCUS, and BN_SETFOCUS notification messages to its parent window. Note that buttons send the BN_CLICKED notification message regardless of whether it has this style.
BS_PUSHLIKE | Makes a button (such as a check box, three-state check box, or radio button) look and act like a push button. The button looks raised when it isn't pushed or checked, and sunken when it is pushed or checked.
BS_RIGHT | Right-justifies text in the button rectangle. However, if the button is a check box or radio button that does not have the BS_RIGHTBUTTON style, the text is right justified on the right side of the check box or radio button.
BS_RIGHTBUTTON | Positions a radio button's circle or a check box's square on the right side of the button rectangle. Same as the BS_LEFTTEXT style.
BS_TEXT | Specifies that the button displays text.
BS_TOP | Places text at the top of the button rectangle.
BS_VCENTER | Places text in the middle (vertically) of the button rectangle.

See Also

WM_COMMAND, WM_DRAWITEM, WM_MEASUREITEM


 BN_CLICKED

The BN_CLICKED notification message is sent when the user clicks a button. The parent window of the button receives this notification message through the WM_COMMAND message. Unlike the other button notification messages, this message is intended for applications written for any version of Windows.

BN_CLICKED

idButton = (int) LOWORD(wParam); // identifier of button

hwndButton = (HWND) lParam; // handle of button

Remarks

A disabled button does not send a BN_CLICKED notification message to its parent window.

See Also

WM_COMMAND


 BN_DBLCLK

The BN_DBLCLK notification message is sent when the user double-clicks a button that has the BS_OWNERDRAW or BS_RADIOBUTTON style. The parent window of the button receives this notification message through a WM_COMMAND message.

BN_DBLCLK

idButton = (int) LOWORD(wParam); // identifier of button

hwndButton = (HWND) lParam; // handle of button

BN_DBLCLK is the same as the BN_DOUBLECLICKED notification message.

This notification is provided for compatibility with applications written for versions of Windows earlier than version 3.0. New applications should use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

See Also

BN_CLICKED, BN_DOUBLECLICKED, WM_COMMAND


 BN_DISABLE

The BN_DISABLE notification message is sent when a button is disabled. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_DISABLE

This notification message is provided for compatibility with applications written for versions of Windows earlier than version 3.0. New applications should use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

See Also

DRAWITEMSTRUCT, WM_COMMAND, WM_DRAWITEM


 BN_DOUBLECLICKED

The BN_DOUBLECLICKED notification message is sent when the user double-clicks a button that has the BS_OWNERDRAW or BS_RADIOBUTTON style. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_DOUBLECLICKED

BN_DOUBLECLICKED is the same as the BN_DBLCLK notification message.

This notification is provided for compatibility with applications written for versions of Windows earlier than version 3.0. New applications should use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

See Also

BN_DBLCLK, DRAWITEMSTRUCT , WM_COMMAND, WM_DRAWITEM


 BN_HILITE

The BN_HILITE notification message is sent when the user selects a button. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_HILITE

This notification message is provided for compatibility with applications written for versions of Windows earlier than version 3.0. New applications should use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

BN_HILITE is the same as the BN_PUSHED notification message.

See Also

BN_PUSHED, BN_UNHILITE, DRAWITEMSTRUCT , WM_COMMAND, WM_DRAWITEM


 BN_KILLFOCUS

The BN_KILLFOCUS notification message is sent when a button loses the keyboard focus. The button must have the BS_NOTIFY style to send this notification message. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_KILLFOCUS

See Also

BN_SETFOCUS, WM_COMMAND


 BN_PAINT

The BN_PAINT notification message is sent when a button should be painted. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_PAINT

This notification message is provided for compatibility with applications written for versions of Windows earlier than version 3.0. New applications should use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

See Also

DRAWITEMSTRUCT, WM_COMMAND, WM_DRAWITEM


 BN_PUSHED

The BN_PUSHED notification message is sent when the push state of a button is set to pushed. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_PUSHED

BN_PUSHED is the same as the BN_HILITE notification message.

This notification message is provided for compatibility with applications written for versions of Windows earlier than version 3.0. New applications should use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

See Also

BN_HILITE, BN_UNPUSHED, DRAWITEMSTRUCT , WM_COMMAND, WM_DRAWITEM


 BN_SETFOCUS

The BN_SETFOCUS notification message is sent when a button receives the keyboard focus. The button must have the BS_NOTIFY style to send this notification message. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_SETFOCUS

See Also

BN_KILLFOCUS, WM_COMMAND


 BN_UNHILITE

The BN_UNHILITE notification message is sent when the highlight should be removed from a button. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_HILITE

BN_UNHILITE is the same as the BN_UNPUSHED notification message.

This notification message is provided for compatibility with applications written for versions of Windows earlier than version 3.0. New applications should use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

See Also

BN_HILITE, BN_UNPUSHED, DRAWITEMSTRUCT , WM_COMMAND, WM_DRAWITEM


 BN_UNPUSHED

The BN_UNPUSHED notification message is sent when the push state of a button is set to unpushed. The parent window of the button receives this notification message through the WM_COMMAND message.

BN_PUSHED

BN_UNPUSHED is the same as the BN_UNHILITE notification message.

This notification message is provided for compatibility with applications written for versions of Windows earlier than version 3.0. New applications should use the BS_OWNERDRAW button style and the DRAWITEMSTRUCT structure for this task.

See Also

BN_PUSHED, DRAWITEMSTRUCT , WM_COMMAND, WM_DRAWITEM


 CB_ADDSTRING

An application sends a CB_ADDSTRING message to add a string to the list box of a combo box. If the combo box does not have the CBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list, and the list is sorted.

CB_ADDSTRING

wParam = 0; // not used; must be zero

lParam = (LPARAM) (LPCTSTR) lpsz; // address of string to add

Parameters

lpsz

Value of lParam. Points to the null-terminated string to be added. If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, the value of the lpsz parameter is stored as item data rather than the string it would otherwise point to. The item data can be retrieved or modified by sending the CB_GETITEMDATA or CB_SETITEMDATA message.

Return Values

The return value is the zero-based index to the string in the list box of the combo box. If an error occurs, the return value is CB_ERR. If insufficient space is available to store the new string, it is CB_ERRSPACE.

Remarks

If you create an owner-drawn combo box with the CBS_SORT style but without the CBS_HASSTRINGS style, the WM_COMPAREITEM message is sent one or more times to the owner of the combo box so the new item can be properly placed in the list.

To insert a string at a specific location within the list, use the CB_INSERTSTRING message.

See Also

CB_DIR, CB_INSERTSTRING, WM_COMPAREITEM


 CB_DELETESTRING

An application sends a CB_DELETESTRING message to delete a string in the list box of a combo box.

CB_DELETESTRING

wParam = (WPARAM) index; // item to delete

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the string to delete.

Return Values

The return value is a count of the strings remaining in the list. If the index parameter specifies an index greater than the number of items in the list, the return value is CB_ERR.

Remarks

If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, Windows sends a WM_DELETEITEM message to the owner of the combo box so the application can free any additional data associated with the item.

See Also

CB_RESETCONTENT, WM_DELETEITEM


 CB_DIR

An application sends a CB_DIR message to add a list of filenames to the list box of a combo box.

CB_DIR

wParam = (WPARAM) (UINT) uAttrs; // file attributes

lParam = (LPARAM) (LPCTSTR) lpszFileSpec; // address of filename

Parameters

uAttrs

Value of wParam. Specifies the attributes of the files to be added to the list box. It can be any combination of the following values:

Value | Meaning
DDL_ARCHIVE | Includes archived files.
DDL_DIRECTORY | Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
DDL_DRIVES | Includes drives. Drives are listed in the form [-x-], where x is the drive letter.
DDL_EXCLUSIVE | Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified.
DDL_HIDDEN | Includes hidden files.
DDL_READONLY | Includes read-only files.
DDL_READWRITE | Includes read-write files with no additional attributes.
DDL_SYSTEM | Includes system files.

lpszFileSpec

Value of lParam. Points to the null-terminated string that specifies the filename to add to the list. If the filename contains any wildcards (for example, *.*), all files that match and have the attributes specified by the uAttrs parameter are added to the list.

Return Values

The return value is the zero-based index of the last filename added to the list. If an error occurs, the return value is CB_ERR. If insufficient space is available to store the new strings, it is CB_ERRSPACE.

See Also

CB_ADDSTRING, CB_INSERTSTRING, DlgDirList, DlgDirListComboBox


 CB_FINDSTRING

An application sends a CB_FINDSTRING message to search the list box of a combo box for an item beginning with the characters in a specified string.

CB_FINDSTRING

wParam = (WPARAM) indexStart; // item before start of search

lParam = (LPARAM) (LPCSTR) lpszFind // prefix string address

Parameters

indexStart

Value of wParam. Specifies the zero-based index of the item preceding the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by the indexStart parameter. If indexStart is [image] 1, the entire list box is searched from the beginning.

lpszFind

Value of lParam. Points to the null-terminated string that contains the prefix to search for. The search is not case sensitive, so this string can contain any combination of uppercase and lowercase letters.

Return Values

The return value is the zero-based index of the matching item. If the search is unsuccessful, it is CB_ERR.

Remarks

If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, what the CB_FINDSTRING message does depends on whether your application uses the CBS_SORT style. If you use the CBS_SORT style, WM_COMPAREITEM messages are sent to the owner of the combo box to determine which item matches the specified string. If you do not use the CBS_SORT style, the CB_FINDSTRING message searches for a list item that matches the value of the lpszFind parameter.

See Also

CB_FINDSTRINGEXACT, CB_SELECTSTRING, CB_SETCURSEL, WM_COMPAREITEM


 CB_FINDSTRINGEXACT

An application sends a CB_FINDSTRINGEXACT message to find the first list box string in a combo box that matches the string specified in the lpszFind parameter.

CB_FINDSTRINGEXACT

wParam = (WPARAM) indexStart; // item before start of search

lParam = (LPARAM)(LPCSTR)lpszFind; // address of string to search for

Parameters

indexStart

Value of wParam. Specifies the zero-based index of the item preceding the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by the indexStart parameter. If indexStart is [image] 1, the entire list box is searched from the beginning.

lpszFind

Value of lParam. Points to the null-terminated string to search for. This string can contain a complete filename, including the extension. The search is not case sensitive, so this string can contain any combination of uppercase and lowercase letters.

Return Values

The return value is the zero-based index of the matching item. If the search is unsuccessful, it is CB_ERR.

Remarks

If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, what the CB_FINDSTRINGEXACT message does depends on whether your application uses the CBS_SORT style. If you use the CBS_SORT style, WM_COMPAREITEM messages are sent to the owner of the combo box to determine which item matches the specified string. If you do not use the CBS_SORT style, the CB_FINDSTRINGEXACT message searches for a list item that matches the value of the lpszFind parameter.

See Also

CB_FINDSTRING, CB_SELECTSTRING, WM_COMPAREITEM


 CB_GETCOUNT

An application sends a CB_GETCOUNT message to retrieve the number of items in the list box of a combo box.

CB_GETCOUNT

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the number of items in the list box. If an error occurs, it is CB_ERR.

Remarks

The index is zero-based, so the returned count is one greater than the index value of the last item.


 CB_GETCURSEL

An application sends a CB_GETCURSEL message to retrieve the index of the currently selected item, if any, in the list box of a combo box.

CB_GETCURSEL

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the zero-based index of the currently selected item. If no item is selected, it is CB_ERR.

See Also

CB_SELECTSTRING, CB_SETCURSEL


 CB_GETDROPPEDCONTROLRECT

An application sends a CB_GETDROPPEDCONTROLRECT message to retrieve the screen coordinates of the drop-down list box of a combo box.

CB_GETDROPPEDCONTROLRECT

wParam = 0; // not used; must be zero

lParam = (LPARAM) (RECT FAR*) lprc; // address of RECT structure

Parameters

lprc

Value of lParam. Points to the RECT structure that is to receive the coordinates.

Return Values

This message always returns CB_OKAY.

See Also

RECT


 CB_GETDROPPEDSTATE

An application sends a CB_GETDROPPEDSTATE message to determine whether the list box of a combo box is dropped down.

CB_GETDROPPEDSTATE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

If the list box is visible, the return value is TRUE; otherwise, it is FALSE.

See Also

CB_SHOWDROPDOWN


 CB_GETDROPPEDWIDTH

An application sends the CB_GETDROPPEDWIDTH message to retrieve the minimum allowable width, in pixels, of the list box of a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style.

CB_GETDROPPEDWIDTH

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

If the message succeeds, the return value is the width, in pixels.

If the message fails, the return value is CB_ERR.

Remarks

By default, the minimum allowable width of the drop-down list box is 0. The width of the list box is either the minimum allowable width or the combo box width, whichever is larger.

See Also

CB_SETDROPPEDWIDTH


 CB_GETEDITSEL

An application sends a CB_GETEDITSEL message to get the starting and ending character positions of the current selection in the edit control of a combo box.

CB_GETEDITSEL

wParam = (WPARAM) (LPDWORD) lpdwStart; // receives starting position

lParam = (LPARAM) (LPDWORD) lpdwEnd; // receives ending position

Parameters

lpdwStart

Value of wParam. Points to a 32-bit value that receives the starting position of the selection. This parameter can be set to NULL.

lpdwEnd

Value of lParam. Points to a 32-bit value that receives the ending position of the selection. This parameter can be set to NULL.

Return Values

The return value is a zero-based 32-bit value with the starting position of the selection in the low-order word and with the ending position of the first character after the last selected character in the high-order word.

See Also

CB_SETEDITSEL


 CB_GETEXTENDEDUI

An application sends a CB_GETEXTENDEDUI message to determine whether a combo box has the default user interface or the extended user interface.

CB_GETEXTENDEDUI

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

If the combo box has the extended user interface, the return value is TRUE; otherwise, it is FALSE.

Remarks

By default, the F4 key opens or closes the list and the DOWN ARROW changes the current selection. In a combo box with the extended user interface, the F4 key is disabled and pressing the DOWN ARROW key opens the drop-down list.

See Also

CB_SETEXTENDEDUI


 CB_GETHORIZONTALEXTENT

An application sends the CB_GETHORIZONTALEXTENT message to retrieve from a combo box the width, in pixels, by which the list box can be scrolled horizontally (the scrollable width). This is applicable only if the list box has a horizontal scroll bar.

CB_GETHORIZONTALEXTENT

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

The return value is the scrollable width, in pixels.

See Also

CB_SETHORIZONTALEXTENT


 CB_GETITEMDATA

An application sends a CB_GETITEMDATA message to a combo box to retrieve the application-supplied 32-bit value associated with the specified item in the combo box.

CB_GETITEMDATA

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the item.

Return Values

The return value is the 32-bit value associated with the item. If an error occurs, it is CB_ERR.

If the item is in an owner-drawn combo box created without the CBS_HASSTRINGS style, the return value is the 32-bit value contained in the lParam parameter of the CB_ADDSTRING or CB_INSERTSTRING message that added the item to the combo box. If the CBS_HASSTRINGS style was not used, the return value is the lParam parameter contained in a CB_SETITEMDATA message.

See Also

CB_ADDSTRING, CB_INSERTSTRING, CB_SETITEMDATA


 CB_GETITEMHEIGHT

An application sends a CB_GETITEMHEIGHT message to determine the height of list items or the selection field in a combo box.

CB_GETITEMHEIGHT

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the combo box component whose height is to be retrieved.

This parameter must be [image] 1 to retrieve the height of the selection field. It must be zero to retrieve the height of list items, unless the combo box has the CBS_OWNERDRAWVARIABLE style. In that case, the index parameter is the zero-based index of a specific list item.

Return Values

The return value is the height, in pixels, of the list items in a combo box. If the combo box has the CBS_OWNERDRAWVARIABLE style, it is is the height of the item specified by the index parameter. If index is [image] 1, the return value is the height of the edit control (or static-text) portion of the combo box. If an error occurs, the return value is CB_ERR.

See Also

CB_SETITEMHEIGHT, WM_MEASUREITEM


 CB_GETLBTEXT

An application sends a CB_GETLBTEXT message to retrieve a string from the list of a combo box.

CB_GETLBTEXT

wParam = (WPARAM) index; // item index

lParam = (LPARAM) (LPCSTR) lpszBuffer; // address of buffer

Parameters

index

Value of wParam. Specifies the zero-based index of the string to retrieve.

lpszBuffer

Value of lParam. Points to the buffer that receives the string. The buffer must have sufficient space for the string and a terminating null character. You can send a CB_GETLBTEXTLEN message prior to the CB_GETLBTEXT message to retrieve the length, in bytes, of the string.

Return Values

The return value is the length of the string, in bytes, excluding the terminating null character. If the index parameter does not specify a valid index, the return value is CB_ERR.

Remarks

If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, the buffer pointed to by the lpszBuffer parameter of the message receives the 32-bit value associated with the item (the item data).

See Also

CB_GETLBTEXTLEN


 CB_GETLBTEXTLEN

An application sends a CB_GETLBTEXTLEN message to retrieve the length, in characters, of a string in the list of a combo box.

CB_GETLBTEXTLEN

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the string.

Return Values

The return value is the length of the string, in characters, excluding the terminating null character. Under certain conditions, this value may actually be greater than the length of the text. For more information, see the following Remarks section.

If the index parameter does not specify a valid index, the return value is CB_ERR.

Remarks

Under certain conditions, the return value is larger than the actual length of the text. This occurs with certain mixtures of ANSI and Unicode, and is due to the operating system allowing for the possible existence of double-byte character set (DBCS) characters within the text. The return value, however, will always be at least as large as the actual length of the text; so you can always use it to guide buffer allocation. This behavior can occur when an application uses both ANSI functions and common dialogs, which use Unicode.

To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the GetWindowText function.

See Also

CB_GETLBTEXT, GetWindowText , LB_GETTEXT, WM_GETTEXT


 CB_GETLOCALE

An application sends a CB_GETLOCALE message to retrieve the current locale of the combo box. The locale is used to determine the correct sorting order of displayed text for combo boxes with the CBS_SORT style and text added by using the CB_ADDSTRING message.

CB_GETLOCALE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is a 32-bit value that specifies the current locale of the combo box. The high word contains the country code and the low-order word contains the language identifier.

Remarks

The language identifier is made up of a sublanguage identifier and a primary language identifier. The PRIMARYLANGID macro obtains the primary language identifier and the SUBLANGID macro obtains the sublanguage identifier.

See Also

CB_ADDSTRING, CB_SETLOCALE, PRIMARYLANGID , SUBLANGID


 CB_GETTOPINDEX

An application sends the CB_GETTOPINDEX message to retrieve the zero-based index of the first visible item in the list box portion of a combo box. Initially the item with index 0 is at the top of the list box, but if the list box contents have been scrolled, another item may be at the top.

CB_GETTOPINDEX

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

If the message is successful, the return value is the index of the first visible item in the list box of the combo box.

If the message fails, the return value is CB_ERR.

See Also

CB_SETTOPINDEX


 CB_INITSTORAGE

An application sends the CB_INITSTORAGE message before adding a large number of items to the list box portion of a combo box. This message allocates memory for storing list box items.

CB_INITSTORAGE

wParam = (WPARAM) (int) cItems; // number of items to add

lParam = (LPARAM) (DWORD) cb; // amount of memory to allocate, in bytes

Parameters

cItems

Specifies the number of items to add.

cb

Specifies the amount of memory to allocate for item strings, in bytes.

Return Values

If the message is successful, the return value is the maximum number of items that the memory object can store.

If the message fails, the return value is CB_ERR.

Remarks

Windows 95: This message helps speed up the initialization of combo boxes that have a large number of items (over 100). It reserves the specified amount of memory so that subsequent CB_ADDSTRING, CB_INSERTSTRING, and CB_DIR messages take the shortest possible time. You can use estimates for the cItems and cb parameters. If you overestimate, the extra memory is allocated, if you underestimate, the normal allocation is used for items that exceed the requested amount.

Windows NT: This message is not needed on Windows NT. It does not reserve the specified amount of memory, because available memory is virtually unlimited. The return value is always the value specified in the cItems parameter.

See Also

CB_ADDSTRING, CB_DIR, CB_INSERTSTRING


 CB_INSERTSTRING

An application sends a CB_INSERTSTRING message to insert a string into the list box of a combo box. Unlike the CB_ADDSTRING message, the CB_INSERTSTRING message does not cause a list with the CBS_SORT style to be sorted.

CB_INSERTSTRING

wParam = (WPARAM) index; // item index

lParam = (LPARAM) (LPCTSTR) lpsz; // address of string to insert

Parameters

index

Value of wParam. Specifies the zero-based index of the position at which to insert the string. If this parameter is [image] 1, the string is added to the end of the list.

lpsz

Value of lParam. Points to the null-terminated string to be inserted. If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, the value of the lpsz parameter is stored rather than the string it would otherwise point to.

Return Values

The return value is the index of the position at which the string was inserted. If an error occurs, the return value is CB_ERR. If there is insufficient space available to store the new string, it is CB_ERRSPACE.

See Also

CB_ADDSTRING, CB_DIR


 CB_LIMITTEXT

An application sends a CB_LIMITTEXT message to limit the length of the text the user may type into the edit control of a combo box.

CB_LIMITTEXT

wParam = (WPARAM) cchLimit; // maximum number of characters

lParam = 0; // not used; must be zero

Parameters

cchLimit

Value of wParam. Specifies the maximum number of characters the user can enter. If this parameter is zero, the text length is set to 0x7FFFFFFE characters.

Return Values

The return value is always TRUE.

Remarks

If the combo box does not have the CBS_AUTOHSCROLL style, setting the text limit to be larger than the size of the edit control has no effect.

The CB_LIMITTEXT message limits only the text the user can enter. It has no effect on any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control when a string in the list box is selected.

The default limit to the text a user can enter in the edit control is 30,000 characters.


 CB_RESETCONTENT

An application sends a CB_RESETCONTENT message to remove all items from the list box and edit control of a combo box.

CB_RESETCONTENT

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

This message always returns CB_OKAY.

Remarks

If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, the owner of the combo box receives a WM_DELETEITEM message for each item in the combo box.

See Also

CB_DELETESTRING, WM_DELETEITEM


 CB_SELECTSTRING

An application sends a CB_SELECTSTRING message to search the list of a combo box for an item that begins with the characters in a specified string. If a matching item is found, it is selected and copied to the edit control.

CB_SELECTSTRING

wParam = (WPARAM) indexStart; // item before first selection

lParam = (LPARAM) (LPCSTR) lpszSelect; // address of prefix string

Parameters

indexStart

Value of wParam. Specifies the zero-based index of the item preceding the first item to be searched. When the search reaches the bottom of the list, it continues from the top of the list back to the item specified by the indexStart parameter. If indexStart is [image] 1, the entire list is searched from the beginning.

lpszSelect

Value of lParam. Points to the null-terminated string that contains the prefix to search for. The search is not case sensitive, so this string can contain any combination of uppercase and lowercase letters.

Return Values

If the string is found, the return value is the index of the selected item. If the search is unsuccessful, the return value is CB_ERR and the current selection is not changed.

Remarks

A string is selected only if the characters from the starting point match the characters in the prefix string.

If you create the combo box with an owner-drawn style but without the CBS_HASSTRINGS style, what the CB_SELECTSTRING message does depends on whether you use the CBS_SORT style. If the CBS_SORT style is used, the system sends WM_COMPAREITEM messages to the owner of the combo box to determine which item matches the specified string. If you do not use the CBS_SORT style, CB_SELECTSTRING attempts to match the DWORD value against the value of the lpszSelect parameter.

See Also

CB_FINDSTRING, CB_FINDSTRINGEXACT, CB_SETCURSEL, WM_COMPAREITEM


 CB_SETCURSEL

An application sends a CB_SETCURSEL message to select a string in the list of a combo box. If necessary, the list scrolls the string into view. The text in the edit control of the combo box changes to reflect the new selection, and any previous selection in the list is removed.

CB_SETCURSEL

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the string to select. If the index parameter is [image] 1, any current selection in the list is removed and the edit control is cleared.

Return Values

If the message is successful, the return value is the index of the item selected. If index is greater than the number of items in the list or if index is set to [image] 1, the return value is CB_ERR and the selection is cleared.

See Also

CB_FINDSTRING, CB_GETCURSEL, CB_SELECTSTRING


 CB_SETDROPPEDWIDTH

An application sends the CB_SETDROPPEDWIDTH message to set the maximum allowable width, in pixels, of the list box of a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style.

CB_SETDROPPEDWIDTH

wParam = (WPARAM) wWidth, // width of list box, in pixels

lParam = 0, // not used, must be zero

Parameters

wWidth

Specifies the width of the list box, in pixels.

Return Values

If the message is successful, The return value is the new width of the list box.

If the message fails, the return value is CB_ERR.

Remarks

By default, the minimum allowable width of the drop-zdown list box is 0. The width of the list box is either the minimum allowable width or the combo box width, whichever is larger.

See Also

CB_GETDROPPEDWIDTH


 CB_SETEDITSEL

An application sends a CB_SETEDITSEL message to select characters in the edit control of a combo box.

CB_SETEDITSEL

wParam = 0; // not used; must be zero

lParam = MAKELPARAM((ichStart), (ichEnd); // start and end position

Parameters

ichStart

Value of the low-order word of lParam; this specifies the starting position. If this parameter is set to [image] 1, the selection, if any, is removed.

ichEnd

Value of the high-order word of lParam; this specifies the ending position. If this parameter is set to [image] 1, all text from the starting position to the last character in the edit control is selected.

Return Values

If the message succeeds, the return value is TRUE. If the message is sent to a combo box with the CBS_DROPDOWNLIST style, it is CB_ERR.

Remarks

The positions are zero-based. The first character of the edit control is in the zero position. The first character after the last selected character is in the ending position. For example, to select the first four characters of the edit control, use a starting position of 0 and an ending position of 4.

See Also

CB_GETEDITSEL


 CB_SETEXTENDEDUI

An application sends a CB_SETEXTENDEDUI message to select either the default user interface or the extended user interface for a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.

CB_SETEXTENDEDUI

wParam = (WPARAM) (BOOL) fExtended; // extended user interface flag

lParam = 0; // not used; must be zero

Parameters

fExtended

Value of wParam. Specifies whether the combo box uses the extended user interface or the default user interface. A value of TRUE selects the extended user interface; a value of FALSE selects the standard user interface.

Return Values

If the operation succeeds, the return value is CB_OKAY. If an error occurs, it is CB_ERR.

Remarks

By default, the F4 key opens or closes the list and the DOWN ARROW changes the current selection. In the extended user interface, the F4 key is disabled and the DOWN ARROW key opens the drop-down list.

See Also

CB_GETEXTENDEDUI


 CB_SETHORIZONTALEXTENT

An application sends the CB_SETHORIZONTALEXTENT message to set the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width). If the width of the list box is smaller than this value, the horizontal scroll bar horizontally scrolls items in the list box. If the width of the list box is equal to or greater than this value, the horizontal scroll bar is hidden or, if the combo box has the CBS_DISABLENOSCROLL style, disabled.

CB_SETHORIZONTALEXTENT

wParam = (WPARAM) cxExtent; // scrollable width of list box, in pixels

lParam = 0; // not used, must be zero

Parameters

cxExtent

Specifies the scrollable width of the list box, in pixels.

Return Values

No return value.

See Also

CB_GETHORIZONTALEXTENT


 CB_SETITEMDATA

An application sends a CB_SETITEMDATA message to set the 32-bit value associated with the specified item in a combo box.

CB_SETITEMDATA

wParam = (WPARAM) index; // item index

lParam = (LPARAM) (DWORD) dwData; // item data

Parameters

index

Value of wParam. Specifies the item's zero-based index.

dwData

Value of lParam. Specifies the new value to be associated with the item.

Return Values

If an error occurs, the return value is CB_ERR.

Remarks

If the specified item is in an owner-drawn combo box created without the CBS_HASSTRINGS style, this message replaces the 32-bit value in the lParam parameter of the CB_ADDSTRING or CB_INSERTSTRING message that added the item to the combo box.

See Also

CB_ADDSTRING, CB_GETITEMDATA, CB_INSERTSTRING


 CB_SETITEMHEIGHT

An application sends a CB_SETITEMHEIGHT message to set the height of list items or the selection field in a combo box.

CB_SETITEMHEIGHT

wParam = (WPARAM) index; // item index

lParam = (LPARAM) (int) height; // item height

Parameters

index

Value of wParam. Specifies the component of the combo box for which to set the height.

This parameter must be [image] 1 to set the height of the selection field. It must be zero to set the height of list items, unless the combo box has the CBS_OWNERDRAWVARIABLE style. In that case, the index parameter is the zero-based index of a specific list item.

height

Value of lParam. Specifies the height, in pixels, of the combo box component identified by index.

Return Values

If the index or height is invalid, the return value is CB_ERR.

Remarks

The selection field height in a combo box is set independently of the height of the list items. An application must ensure that the height of the selection field is not smaller than the height of a particular list item.

See Also

CB_GETITEMHEIGHT, WM_MEASUREITEM


 CB_SETLOCALE

An application sends a CB_SETLOCALE message to set the current locale of the combo box. If the combo box has the CBS_SORT style and strings are added using CB_ADDSTRING, the locale of a combo box affects how list items are sorted.

CB_SETLOCALE

wParam = (WPARAM) (WORD) wLocaleID; // locale identifier

lParam = 0; // not used; must be zero

Parameters

wLocaleID

Value of wParam. Specifies the locale identifier for the combo box to use for sorting when adding text.

Return Values

The return value is the previous locale identifier. If wParam specifies a locale not installed on the system, the return value is CB_ERR and the current combo box locale is not changed.

Remarks

Use the MAKELCID macro to construct a locale identifier and the MAKELANGID macro to construct a language identifier. The language identifier is made up of a primary language identifier and a sublanguage identifier.

See Also

CB_ADDSTRING, CB_GETLOCALE, MAKELANGID , MAKELCID


 CB_SETTOPINDEX

An application sends the CB_SETTOPINDEX message to ensure that a particular item is visible in the list box of a combo box. The system scrolls the list box contents so that either the specified item appears at the top of the list box or the maximum scroll range has been reached.

CB_SETTOPINDEX

wParam = (WPARAM) index; // zero-based index of item list

lParam = 0; // not used, must be zero

Parameters

index

Specifies the zero-based index of the list item.

Return Values

If the message is successful, the return value is zero.

If the message fails, the return value is CB_ERR.

See Also

CB_GETTOPINDEX


 CB_SHOWDROPDOWN

An application sends a CB_SHOWDROPDOWN message to show or hide the list box of a combo box that has the CBS_DROPDOWN or CBS_DROPDOWNLIST style.

CB_SHOWDROPDOWN

wParam = (WPARAM) (BOOL) fShow; // the show/hide flag

lParam = 0; // not used; must be zero

Parameters

fShow

Value of wParam. Specifies whether the drop-down list box is to be shown or hidden. A value of TRUE shows the list box; a value of FALSE hides it.

Return Values

The return value is always TRUE.

Remarks

This message has no effect on a combo box created with the CBS_SIMPLE style.

See Also

CB_GETDROPPEDSTATE


 CBN_CLOSEUP

The CBN_CLOSEUP notification message is sent when the list box of a combo box has been closed. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_CLOSEUP

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

Remarks

This notification message is not sent to a combo box that has the CBS_SIMPLE style.

In general, you cannot predict the order in which notifications will be sent. In particular, a CBN_SELCHANGE notification message may occur either before or after a CBN_CLOSEUP notification message.

See Also

CBN_DROPDOWN, CBN_SELCHANGE, WM_COMMAND


 CBN_DBLCLK

The CBN_DBLCLK notification message is sent when the user double-clicks a string in the list box of a combo box. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_DBLCLK

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

Remarks

This notification message occurs only for a combo box with the CBS_SIMPLE style. In a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style, a double-click cannot occur because a single click closes the list box.

See Also

CBN_SELCHANGE, WM_COMMAND


 CBN_DROPDOWN

The CBN_DROPDOWN notification message is sent when the list box of a combo box is about to be made visible. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_DROPDOWN

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

Remarks

This notification message can occur only for a combo box with the CBS_DROPDOWN or CBS_DROPDOWNLIST style.

See Also

CBN_CLOSEUP, WM_COMMAND


 CBN_EDITCHANGE

The CBN_EDITCHANGE notification message is sent after the user has taken an action that may have altered the text in the edit control portion of a combo box. Unlike the CBN_EDITUPDATE notification message, this notification message is sent after Windows updates the screen. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_EDITCHANGE

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND)lParam; // handle of combo box

Remarks

If the combo box has the CBS_DROPDOWNLIST style, this notification message does not occur.

See Also

CBN_EDITUPDATE, WM_COMMAND


 CBN_EDITUPDATE

The CBN_EDITUPDATE notification message is sent when the edit control portion of a combo box is about to display altered text. This notification message is sent after the control has formatted the text, but before it displays the text. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_EDITUPDATE

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

Remarks

If the combo box has the CBS_DROPDOWNLIST style, this notification message does not occur.

See Also

CBN_EDITCHANGE, WM_COMMAND


 CBN_ERRSPACE

The CBN_ERRSPACE notification message is sent when a combo box cannot allocate enough memory to meet a specific request. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_ERRSPACE

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

See Also

WM_COMMAND


 CBN_KILLFOCUS

The CBN_KILLFOCUS notification message is sent when a combo box loses the keyboard focus. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_KILLFOCUS

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

See Also

CBN_SETFOCUS, WM_COMMAND


 CBN_SELCHANGE

The CBN_SELCHANGE notification message is sent when the selection in the list box of a combo box is about to be changed as a result of the user either clicking in the list box or changing the selection by using the arrow keys. The parent window of the combo box receives this message through the WM_COMMAND message.

CBN_SELCHANGE

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

See Also

CBN_DBLCLK, WM_COMMAND


 CBN_SELENDCANCEL

The CBN_SELENDCANCEL notification message is sent when the user selects an item, but then selects another control or closes the dialog box. It indicates the user's initial selection is to be ignored. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_SELENDCANCEL

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

Remarks

In a combo box with the CBS_SIMPLE style, the CBN_SELENDCANCEL notification message is not sent. The CBN_SELENDOK notification message is sent immediately before every CBN_SELCHANGE notification message.

If the WS_EX_NOPARENTNOTIFY extended window style is specified for the combo box, the CBN_SELENDCANCEL notification message is not sent.

See Also

CBN_SELCHANGE, CBN_SELENDOK, WM_COMMAND


 CBN_SELENDOK

The CBN_SELENDOK notification message is sent when the user selects a list item, or selects an item and then closes the list. It indicates that the user's selection is to be processed. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_SELENDOK

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

Remarks

In a combo box with the CBS_SIMPLE style, the CBN_SELENDOK notification message is sent immediately before every CBN_SELCHANGE notification message.

If the WS_EX_NOPARENTNOTIFY extended window style is specified for the combo box, the CBN_SELENDOK notification message is not sent.

See Also

CBN_SELCHANGE, CBN_SELENDCANCEL, WM_COMMAND


 CBN_SETFOCUS

The CBN_SETFOCUS notification message is sent when a combo box receives the keyboard focus. The parent window of the combo box receives this notification message through the WM_COMMAND message.

CBN_SETFOCUS

idComboBox = (int) LOWORD(wParam); // identifier of combo box

hwndComboBox = (HWND) lParam; // handle of combo box

See Also

CBN_KILLFOCUS, WM_COMMAND


 CBT_CREATEWND

The CBT_CREATEWND structure contains information passed to a WH_CBT hook procedure before a window is created.

typedef struct tagCBT_CREATEWND { // cbtcw

LPCREATESTRUCT lpcs;

HWND hwndInsertAfter;

} CBT_CREATEWND;

Members

lpcs

Points to a CREATESTRUCT structure that contains initialization parameters for the window about to be created.

hwndInsertAfter

Identifies the window whose position in the Z order precedes that of the window being created.

See Also

CBTProc, CREATESTRUCT , SetWindowsHookEx


 CBTACTIVATESTRUCT

The CBTACTIVATESTRUCT structure contains information passed to a WH_CBT hook procedure before a window is activated.

typedef struct tagCBTACTIVATESTRUCT { // cas

BOOL fMouse;

HWND hWndActive;

} CBTACTIVATESTRUCT;

Members

fMouse

Specifies whether the window is being activated as a result of a mouse click. This value is TRUE if a mouse click is causing the activation or FALSE if it is not.

hWndActive

Identifies the active window.

See Also

SetWindowsHookEx


 CBTProc

The CBTProc hook procedure is an application-defined or library-defined callback function that the system calls before activating, creating, destroying, minimizing, maximizing, moving, or sizing a window; before completing a system command; before removing a mouse or keyboard event from the system message queue; before setting the keyboard focus; or before synchronizing with the system message queue. The value returned by the hook procedure determines whether Windows allows or prevents one of these operations. A computer-based training (CBT) application uses this hook procedure to receive useful notifications from the system.

LRESULT CALLBACK CBTProc(

int nCode, | // hook code
WPARAM wParam, | // depends on hook code
LPARAM lParam | // depends on hook code
); |

Parameters

nCode

Specifies a code that the hook procedure uses to determine how to process the message. This parameter can be one of the following values:

Value | Meaning
HCBT_ACTIVATE | The system is about to activate a window.
HCBT_CLICKSKIPPED | The system has removed a mouse message from the system message queue. Upon receiving this hook code, a CBT application must install a WH_JOURNALPLAYBACK hook procedure in response to the mouse message.
HCBT_CREATEWND | A window is about to be created. The system calls the hook procedure before sending the WM_CREATE or WM_NCCREATE message to the window. If the hook procedure returns a nonzero value, the system destroys the window; the CreateWindow function returns NULL, but the WM_DESTROY message is not sent to the window. If the hook procedure returns zero, the window is created normally.
 | At the time of the HCBT_CREATEWND notification, the window has been created, but its final size and position may not have been determined and its parent window may not have been established. It is possible to send messages to the newly created window, although it has not yet received WM_NCCREATE or WM_CREATE messages. It is also possible to change the position in the Z order of the newly created window by modifying the hwndInsertAfter member of the CBT_CREATEWND structure.
HCBT_DESTROYWND | A window is about to be destroyed.
HCBT_KEYSKIPPED | The system has removed a keyboard message from the system message queue. Upon receiving this hook code, a CBT application must install a WH_JOURNALPLAYBACK_hook hook procedure in response to the keyboard message.
HCBT_MINMAX | A window is about to be minimized or maximized.
HCBT_MOVESIZE | A window is about to be moved or sized.
HCBT_QS | The system has retrieved a WM_QUEUESYNC message from the system message queue.
HCBT_SETFOCUS | A window is about to receive the keyboard focus.
HCBT_SYSCOMMAND | A system command is about to be carried out. This allows a CBT application to prevent task switching by means of hot keys.

If nCode is less than zero, the hook procedure must pass the message to the CallNextHookEx function without further processing and should return the value returned by CallNextHookEx.

wParam

Depends on the nCode parameter. For details, see the following Remarks section.

lParam

Depends on the nCode parameter. For details, see the following Remarks section.

Return Values

For operations corresponding to the following CBT hook codes, the return value must be 0 to allow the operation, or 1 to prevent it:

HCBT_ACTIVATE
HCBT_CREATEWND
HCBT_DESTROYWND
HCBT_MINMAX
HCBT_MOVESIZE
HCBT_SETFOCUS
HCBT_SYSCOMMAND

For operations corresponding to the following CBT hook codes, the return value is ignored:

HCBT_CLICKSKIPPED
HCBT_KEYSKIPPED
HCBT_QS

Remarks

The hook procedure should not install a WH_JOURNALPLAYBACK_hook hook procedure except in the situations described in the preceding list of hook codes.

This hook procedure must be in a dynamic-link library (DLL). An application installs the hook procedure by specifying the WH_CBT hook type and the address of the hook procedure in a call to the SetWindowsHookEx function.

The following table describes the wParam and lParam parameters for each HCBT_ hook code:

Value | wParam | lParam
HCBT_ACTIVATE | Specifies the handle to the window about to be activated. | Specifies a long pointer to a CBTACTIVATESTRUCT structure containing the handle to the active window and specifies whether the activation is changing because of a mouse click.
HCBT_CLICKSKIPPED | Identifies the mouse message removed from the system message queue. | Specifies a long pointer to a MOUSEHOOKSTRUCT structure containing the hit-test code and the handle to the window for which the mouse message is intended. The HCBT_CLICKSKIPPED value is sent to a CBTProc hook procedure only if a WH_MOUSE hook is installed. For a list of hit-test codes, see WM_NCHITTEST .
HCBT_CREATEWND | Specifies the handle to the new window. | Specifies a long pointer to a CBT_CREATEWND structure containing initialization parameters for the window. The parameters include the coordinates and dimensions of the window. By changing these parameters, a CBTProc hook procedure can set the initial size and position of the window.
HCBT_DESTROYWND | Specifies the handle to the window about to be destroyed. | Is undefined and must be set to zero.
HCBT_KEYSKIPPED | Identifies the virtual-key code. | Specifies the repeat count, scan code, key-transition code, previous key state, and context code. The HCBT_KEYSKIPPED value is sent to a CBTProc hook procedure only if a WH_KEYBOARD hook is installed. For more information, see the WM_KEYUP or WM_KEYDOWN message.
HCBT_MINMAX | Specifies the handle to the window being minimized or maximized. | Specifies, in the low-order word, a show-window value (SW_) specifying the operation. For a list of show-window values, see the ShowWindow . The high-order word is undefined.
HCBT_MOVESIZE | Specifies the handle to the window to be moved or sized. | Specifies a long pointer to a RECT structure containing the coordinates of the window. By changing the values in the structure, a CBTProc hook procedure can set the final coordinates of the window.
HCBT_QS | Is undefined and must be zero. | Is undefined and must be zero.
HCBT_SETFOCUS | Specifies the handle to the window gaining the keyboard focus. | Specifies the handle to the window losing the keyboard focus.
HCBT_SYSCOMMAND | Specifies a system-command value (SC_) specifying the system command. For more information about system-command values, see WM_SYSCOMMAND . | Contains the same data as the lParam value of a WM_SYSCOMMAND message: If a system menu command is chosen with the mouse, the low-order word contains the x-coordinate of the cursor, in screen coordinates, and the high-order word contains the y-coordinate; otherwise, the parameter is not used.

CBTProc is a placeholder for the application-defined or library-defined function name.

See Also

CallNextHookEx, CreateWindow, SetWindowsHookEx, WM_SYSCOMMAND


 EM_CANPASTE

The EM_CANPASTE message determines whether a rich edit control can paste a specified clipboard format.

EM_CANPASTE

wParam = (WPARAM) (UINT) uFormat;

lParam = 0;

Parameters

uFormat

Value identifying the clipboard format to try, or zero to try any format currently on the clipboard.

Return Values

Returns a nonzero value if the clipboard format can be pasted or zero otherwise.


 EM_CANUNDO

An application sends an EM_CANUNDO message to determine whether an edit-control operation can be undone; that is, whether the control can respond to the EM_UNDO message.

EM_CANUNDO

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

If the edit control can correctly process the EM_UNDO message, the return value is TRUE; otherwise, it is FALSE.

See Also

EM_UNDO


 EM_CHARFROMPOS

An application sends an EM_CHARFROMPOS message to retrieve the zero-based character index and zero-based line index of the character nearest the specified point in an edit control.

EM_CHARFROMPOS

wParam = 0;

lParam = MAKELPARAM(x, y)

Parameters

x

Value of the low-order word of lParam. Specifies the x-coordinate of a point in the edit control's client area. The coordinate is relative to the upper-left corner of the client area.

y

Value of the high-order word of lParam. Specifies the y-coordinate of a point in the edit control's client area. The coordinate is relative to the upper-left corner of the client area.

Return Values

The return value specifies the character index in the low-order word and the line index in the high-order word. For single-line edit controls, the line index is always 0. The return value is the last character in the edit control if the given point is beyond the last character in the control. The return value is [image] 1 if the specified point is outside the client area of the edit control.

See Also

EM_POSFROMCHAR


 EM_DISPLAYBAND

The EM_DISPLAYBAND message displays a portion of a rich edit control's contents, as previously formatted for a device using the EM_FORMATRANGE message.

EM_DISPLAYBAND

wParam = 0;

lParam = (LPARAM) (LPRECT) lprc;

Parameters

lprc

Pointer to a RECT structure specifying the area of the device to display to.

Return Values

If the operation succeeds, the return value is TRUE.

If the operation fails, the return value is FALSE.

Remarks

Text and OLE objects are clipped by the rectangle. The application does not need to set the clipping region.

See Also

EM_FORMATRANGE, RECT


 EM_EMPTYUNDOBUFFER

An application sends an EM_EMPTYUNDOBUFFER message to reset the undo flag of an edit control. The undo flag is set whenever an operation within the edit control can be undone.

EM_EMPTYUNDOBUFFER

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

The undo flag is automatically reset whenever the edit control receives a WM_SETTEXT or EM_SETHANDLE message.

See Also

EM_CANUNDO, EM_SETHANDLE, EM_UNDO, WM_SETTEXT


 EM_EXGETSEL

The EM_EXGETSEL message retrieves the starting and ending character positions of the selection in a rich edit control.

EM_EXGETSEL

wParam = 0;

lParam = (LPARAM) (CHARRANGE FAR *) lpchr;

Parameters

lpchr

Pointer to a CHARRANGE structure that receives the selection range.

Return Values

No return value.

See Also

CHARRANGE


 EM_EXLIMITTEXT

The EM_EXLIMITTEXT message sets an upper limit to the amount of text in a rich edit control.

EM_EXLIMITTEXT

wParam = 0;

lParam = (LPARAM) (DWORD) cchTextMax;

Parameters

cchTextMax

Maximum amount of text or zero for the default maximum. An OLE object counts as a single character. The default maximum is 32K.

Return Values

No return value.


 EM_EXLINEFROMCHAR

The EM_EXLINEFROMCHAR message determines which line contains the specified character in a rich edit control.

EM_EXLINEFROMCHAR

wParam = 0;

lParam = (LPARAM) (DWORD) ichCharPos;

Parameters

ichCharPos

Zero-based index of the character.

Return Values

Returns the zero-based index of the line.


 EM_EXSETSEL

The EM_EXSETSEL message selects a range of characters and/or OLE objects in a rich edit control.

EM_EXSETSEL

wParam = 0;

lParam = (LPARAM) (CHARRANGE FAR *) ichCharRange;

Parameters

ichCharRange

Zero-based index of the character.

Return Values

Returns the zero-based index of the line.


 EM_FINDTEXT

The EM_FINDTEXT message finds text within a rich edit control.

EM_FINDTEXT

wParam = (WPARAM) (UINT) fuFlags;

lParam = (LPARAM) (FINDTEXT FAR *) lpFindText;

Parameters

fuFlags

Zero or more of the FT_MATCHCASE and FT_WHOLEWORD values.

lpFindText

Pointer to a FINDTEXT structure containing information about the find operation.

Return Values

Returns the zero-based character position of the next match, or [image] 1 if there are no more matches.

See Also

FINDTEXT


 EM_FINDTEXTEX

Finds text within a rich edit control.

EM_FINDTEXTEX

wParam = (WPARAM) (UINT) fuFlags;

lParam = (LPARAM) (FINDTEXTEX FAR *) lpFindText;

Parameters

fuFlags

Zero or more of the FT_MATCHCASE and FT_WHOLEWORD values.

lpFindText

Address of a FINDTEXTEX structure containing information about the find operation.

Return Values

Returns the zero-based character position of the next match or [image] 1 if there are no more matches.

See Also

FINDTEXTEX


 EM_FINDWORDBREAK

The EM_FINDWORDBREAK message finds the next word break before or after the specified character position, or retrieves information about the character at that position.

EM_FINDWORDBREAK

wParam = (WPARAM) (UINT) code;

lParam = (LPARAM) (DWORD) ichStart;

Parameters

code

Action to take. This parameter can be one of these values:

Value | Meaning
WB_CLASSIFY | Returns the character class and word break flags of the character at the specified position.
WB_ISDELIMITER | Returns TRUE if the character at the specified position is a delimiter, or FALSE otherwise.
WB_LEFT | Finds the nearest character before the specified position that begins a word.
WB_LEFTBREAK | Finds the next word end before the specified position. Same as WB_PREVBREAK.
WB_MOVEWORDLEFT | Finds the next character that begins a word before the specified position. This value is used during CTRL+LEFT key processing. Same as WB_MOVEWORDPREV.
WB_MOVEWORDRIGHT | Finds the next character that begins a word after the specified position. This value is used during CTRL+RIGHT key processing. Same as WB_MOVEWORDNEXT.
WB_RIGHT | Finds the next character that begins a word after the specified position.
WB_RIGHTBREAK | Finds the next end-of-word delimiter after the specified position. Same as WB_NEXTBREAK.

ichStart

Zero-based character position to start from.

Return Values

Returns the character index of the word break, unless the code parameter is the WB_CLASSIFY or WB_ISDELIMITER value. For more information, see the description of the code parameter.

Remarks

If code is WB_LEFT and WB_RIGHT, the word break procedure finds word breaks only after delimiters. This matches the functionality of an edit control. If code is WB_MOVEWORDLEFT or WB_MOVEWORDRIGHT, the word break procedure also compares character classes and word break flags.

For information about character classes and word break flags, see Word and Line Breaks.


 EM_FMTLINES

An application sends an EM_FMTLINES message to set the inclusion flag of soft linebreak characters on or off within a multiline edit control. A soft linebreak consists of two carriage returns and a linefeed and is inserted at the end of a line that is broken because of wordwrapping.

EM_FMTLINES

wParam = (WPARAM) (BOOL) fAddEOL; // linebreak flag

lParam = 0; // not used; must be zero

Parameters

fAddEOL

Value of wParam. Specifies whether soft-linebreak characters are to be inserted. A value of TRUE inserts the characters; a value of FALSE removes them.

Return Values

The return value is identical to the fAddEOL parameter.

Remarks

This message affects only the buffer returned by the EM_GETHANDLE message and the text returned by the WM_GETTEXT message. It has no effect on the display of the text within the edit control.

The EM_FMTLINES message does not affect a line that ends with a hard linebreak. A hard linebreak consists of one carriage return and a linefeed.

Note that the size of the text changes when this message is processed.

See Also

EM_GETHANDLE, WM_GETTEXT


 EM_FORMATRANGE

The EM_FORMATRANGE message formats a range of text in a rich edit control for a specific device.

EM_FORMATRANGE

wParam = (WPARAM) (BOOL) fRender;

lParam = (LPARAM) (FORMATRANGE FAR *) lpFmt;

Parameters

fRender

Value specifying whether to render the text. If this parameter is nonzero, the text is rendered. Otherwise, the text is just measured.

lpFmt

Pointer to a FORMATRANGE structure containing information about the output device, or NULL to free information cached by the control.

This message is typically used with the EM_DISPLAYBAND message to format a rich edit control's contents for an output device such as a printer.

It is very important to free cached information after the last time you use this message by specifying NULL in lpFmt. In addition, after using this message for one device, you must free cached information before using it again for a different device.

Return Values

Returns the index of the last character that fits in the region plus one.

See Also

EM_DISPLAYBAND, FORMATRANGE


 EM_GETCHARFORMAT

The EM_GETCHARFORMAT message determines the current character formatting in a rich edit control.

EM_GETCHARFORMAT

wParam = (WPARAM) (BOOL) fSelection;

lParam = (LPARAM) (CHARFORMAT FAR *) lpFmt;

Parameters

fSelection

Value specifying whether to get the default character formatting or the current selection's character formatting. If this parameter is zero, the default formatting is returned. Otherwise, the current selection's formatting is returned.

lpFmt

Pointer to a CHARFORMAT structure to fill in. If the selection formatting is being retrieved, the structure receives the attributes of the first character, and the dwMask member specifies which attributes are consistent throughout the entire selection.

Return Values

Returns the value of the dwMask member of the CHARFORMAT structure.

See Also

CHARFORMAT


 EM_GETEVENTMASK

The EM_GETEVENTMASK message retrieves the event mask for a rich edit control. The event mask specifies which notification messages the control sends to its parent window.

EM_GETEVENTMASK

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Return Values

Returns the event mask for the rich edit control.


 EM_GETFIRSTVISIBLELINE

An application sends an EM_GETFIRSTVISIBLELINE message to determine the uppermost visible line in an edit control.

EM_GETFIRSTVISIBLELINE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the zero-based index of the uppermost visible line in a multiline edit control. For single-line edit controls, the return value is the zero-based index of the first visible character.


 EM_GETHANDLE

An application sends an EM_GETHANDLE message to retrieve a handle of the memory currently allocated for a multiline edit control's text.

EM_GETHANDLE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is a memory handle identifying the buffer that holds the content of the edit control. If an error occurs, such as sending the message to a single-line edit control, the return value is zero.

Remarks

In a 16-bit Windows-based application, the handle is a local memory handle and can be used only by functions that take a local memory handle as a parameter. The application can send this message to a multiline edit control in a dialog box only if it created the dialog box with the DS_LOCALEDIT style flag set. If the DS_LOCALEDIT style is not set, the return value is still nonzero, but the return value will not be meaningful.

See Also

EM_SETHANDLE


 EM_GETIMECOLOR

Retrieves the IME composition color. This message is available only in Asian-language versions of the operating system.

EM_GETIMECOLOR
wParam = (WPARAM) 0;
lParam = (LPARAM) (COMPCOLOR *) aCompColor;

Parameters

aCompColor

Address of a 4-element array of COMPCOLOR structures that receives the composition color.

Return Values

Returns nonzero if successful, zero otherwise.

See Also

COMPCOLOR


 EM_GETIMEOPTIONS

Retrieves the current IME options. This message is available only in Asian-language versions of the operating system.

EM_GETIMEOPTIONS
wParam = (WPARAM) 0;
lParam = (LPARAM) 0;

Return Values

Returns a combination of the IME option values described for the EM_SETIMEOPTIONS message.

See Also

EM_SETIMEOPTIONS


 EM_GETLIMITTEXT

An application sends the EM_GETLIMITTEXT message to retrieve the current text limit, in characters, for an edit control.

EM_GETLIMITTEXT

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

The return value is the text limit.

See Also

EM_SETLIMITTEXT


 EM_GETLINE

An application sends an EM_GETLINE message to copy a line of text from an edit control and place it in a specified buffer.

EM_GETLINE

wParam = (WPARAM) line; // line number to retrieve

lParam = (LPARAM) (LPCSTR) lpch; // address of buffer for line

Parameters

line

Value of wParam. Specifies the zero-based index of the line to retrieve from a multiline edit control. A value of zero specifies the topmost line. This parameter is ignored by a single-line edit control.

lpch

Value of lParam. Points to the buffer that receives a copy of the line. The first word of the buffer specifies the maximum number of characters that can be copied to the buffer.

Return Values

The return value is the number of characters copied. The return value is zero if the line number specified by the line parameter is greater than the number of lines in the edit control.

Remarks

The copied line does not contain a terminating null character.

See Also

EM_LINELENGTH, WM_GETTEXT


 EM_GETLINECOUNT

An application sends an EM_GETLINECOUNT message to retrieve the number of lines in a multiline edit control.

EM_GETLINECOUNT

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is an integer specifying the number of lines in the multiline edit control. If no text is in the edit control, the return value is 1.

See Also

EM_GETLINE, EM_LINELENGTH


 EM_GETMARGINS

An application sends the EM_GETMARGINS message to retrieve the widths of the left and right margins for an edit control.

EM_GETMARGINS

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

Returns the width of the left margin in the low-order word, and the width of the right margin in the high-order word.

See Also

EM_SETMARGINS


 EM_GETMODIFY

An application sends an EM_GETMODIFY message to determine whether the content of an edit control has been modified.

EM_GETMODIFY

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

If the content of edit control has been modified, the return value is TRUE; otherwise, it is FALSE.

Remarks

Windows maintains an internal flag indicating whether the content of the edit control has been changed. This flag is cleared when the edit control is first created; alternatively, an application can send an EM_SETMODIFY message to the edit control to clear the flag.

See Also

EM_SETMODIFY


 EM_GETOLEINTERFACE

The EM_GETOLEINTERFACE message retrieves an IRichEditOle object that a client can use to access a rich edit control's OLE functionality.

EM_GETOLEINTERFACE

wParam = 0;

lParam = (LPARAM) (LPVOID FAR *) ppObject;

Parameters

ppObject

Address at which the control stores a pointer to the IRichEditOle object. The control calls the AddRef function for the object before returning, so the calling application must call the Release function when it is done with the object.

Return Values

Returns a nonzero value if successful, or zero otherwise.

See Also

IRichEditOle


 EM_GETOPTIONS

Retrieves the rich edit control options.

EM_GETOPTIONS
wParam = (WPARAM) 0;
lParam = (LPARAM) 0;

Return Values

Returns the current option values. Can be a combination of values described for the EM_SETOPTIONS message.

See Also

EM_SETOPTIONS


 EM_GETPARAFORMAT

The EM_GETPARAFORMAT message retrieves the paragraph formatting of the current selection in a rich edit control.

EM_GETPARAFORMAT

wParam = 0;

lParam = (LPARAM) (PARAFORMAT FAR *) lpFmt;

Parameters

lpFmt

Pointer to a PARAFORMAT structure that receives the paragraph formatting attributes of the current selection.

If more than one paragraph is selected, the structure receives the attributes of the first paragraph, and the dwMask member specifies which attributes are consistent throughout the entire selection.

Return Values

Returns the value of the dwMask member of the PARAFORMAT structure.

See Also

PARAFORMAT


 EM_GETPASSWORDCHAR

An application sends an EM_GETPASSWORDCHAR message to retrieve the password character displayed in an edit control when the user enters text.

EM_GETPASSWORDCHAR

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value specifies the character to be displayed in place of the character typed by the user. The return value is NULL if no password character exists.

Remarks

If the edit control is created with the ES_PASSWORD style, the default password character is set to an asterisk (*).

See Also

EM_SETPASSWORDCHAR


 EM_GETPUNCTUATION

Gets the current punctuation characters for the rich edit control. This message is available only in Asian-language versions of the operating system.

EM_GETPUNCTUATION
wParam = (WPARAM) (UINT) fType;
lParam = (LPARAM) (PUNCTUATION FAR *) punctTable;

Parameters

fType

Punctuation type flag. Can be one of the following values:

Value | Meaning
PC_LEADING | Leading punctuation characters
PC_FOLLOWING | Following punctuation characters
PC_DELIMITER | Delimiter

The PC_OVERFLOW value is not supported.

punctTable

Address of a PUNCTUATION structure that receives the punctuation characters.

Return Values

Returns nonzero if successful; zero otherwise.

See Also

PUNCTUATION


 EM_GETRECT

An application sends an EM_GETRECT message to retrieve the formatting rectangle of an edit control. The formatting rectangle is the limiting rectangle of the text. The limiting rectangle is independent of the size of the edit-control window.

EM_GETRECT

wParam = 0; // not used; must be zero

lParam (LPARAM) (LPRECT) lprc; // address of structure for rectangle

Parameters

lprc

Value of lParam. Points to the RECT structure that receives the formatting rectangle.

Return Values

The return value is not a meaningful value.

Remarks

You can modify the formatting rectangle of a multiline edit control by using the EM_SETRECT and EM_SETRECTNP messages.

See Also

EM_SETRECT, EM_SETRECTNP, RECT


 EM_GETSEL

An application sends an EM_GETSEL message to get the starting and ending character positions of the current selection in an edit control.

EM_GETSEL

wParam = (WPARAM) (LPDWORD) lpdwStart; // receives starting position

lParam = (LPARAM) (LPDWORD) lpdwEnd; // receives ending position

Parameters

lpdwStart

Value of wParam. Points to a 32-bit value that receives the starting position of the selection. This parameter can be NULL.

lpdwEnd

Value of lParam. Points to a 32-bit value that receives the position of the first nonselected character after the end of the selection. This parameter can be NULL.

Return Values

The return value is a zero-based 32-bit value with the starting position of the selection in the low-order word and the position of the first character after the last selected character in the high-order word. If either of these values exceeds 65, 535, the return value is -1.

Remarks

In a rich edit control, if the selection is not entirely contained in the first 64K, use the message EM_EXGETSEL.

See Also

EM_EXGETSEL, EM_SETSEL


 EM_GETSELTEXT

The EM_GETSELTEXT message retrieves the currently selected text in a rich edit control.

EM_GETSELTEXT

wParam = 0;

lParam = (LPARAM) (LPSTR) lpBuf;

Parameters

lpBuf

Pointer to a buffer that receives the selected text. The calling application must ensure that the buffer is large enough to hold the selected text.

Return Values

Returns the number of characters copied, not including the terminating null character.


 EM_GETTEXTRANGE

The EM_GETTEXTRANGE message retrieves a specified range of characters from a rich edit control.

EM_GETTEXTRANGE

wParam = 0;

lParam = (LPARAM) (TEXTRANGE FAR *) lpRange;

Parameters

lpRange

Pointer to a TEXTRANGE structure that specifies the range of characters to retrieve and a buffer to copy the characters to.

Return Values

Returns the number of characters copied, not including the terminating null character.

See Also

TEXTRANGE


 EM_GETTHUMB

An application sends the EM_GETTHUMB message to retrieve the position of the scroll box (thumb) in a multiline edit control.

EM_GETTHUMB

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

The return value is the position of the scroll box.


 EM_GETWORDBREAKPROC

An application sends an EM_GETWORDBREAKPROC message to an edit control to retrieve the address of the current wordwrap function.

EM_GETWORDBREAKPROC

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value specifies the address of the application-defined wordwrap function. The return value is NULL if no wordwrap function exists.

Remarks

A wordwrap function scans a text buffer that contains text to be sent to the display, looking for the first word that does not fit on the current display line. The wordwrap function places this word at the beginning of the next line on the display. A wordwrap function defines the point at which Windows should break a line of text for multiline edit controls, usually at a space character that separates two words.

See Also

EditWordBreakProc, EM_FMTLINES, EM_SETWORDBREAKPROC


 EM_GETWORDBREAKPROCEX

Retrieves the address of the currently registered extended word break procedure.

EM_GETWORDBREAKPROCEX
wParam = (WPARAM) 0;
lParam = (LPARAM) 0;

Return Values

Returns the address of the current procedure.


 EM_GETWORDWRAPMODE

Gets the current word wrapping and word breaking options for the rich edit control. This message is available only in Asian-language versions of the operating system.

EM_GETWORDWRAPMODE
wParam = (WPARAM) 0;
lParam = (LPARAM) 0:

Return Values

Returns the current word wrapping and word breaking options.

Remarks

This message must not be sent by the application-defined word breaking procedure.


 EM_HIDESELECTION

The EM_HIDESELECTION message hides or shows the selection in a rich edit control.

EM_HIDESELECTION

wParam = (WPARAM) (BOOL) fHide;

lParam = (LPARAM) (BOOL) fChangeStyle;

Parameters

fHide

Value specifying whether to hide or show the selection. If this parameter is zero, the selection is shown. Otherwise, the selection is hidden.

fChangeStyle

Value specifying whether to change the control's ES_NOHIDESEL window style. If this parameter is zero, the selection is temporarily shown or hidden. Otherwise, the style is changed.

If this parameter is nonzero and the control has the focus, the selection is hidden or shown as appropriate.

Return Values

No return value.


 EM_LIMITTEXT

An application sends an EM_LIMITTEXT message to limit the amount of text the user may enter into an edit control.

EM_LIMITTEXT

wParam = (WPARAM) cchMax; // text length, in characters

lParam = 0; // not used; must be zero

Parameters

cchMax

Value of wParam. Specifies the maximum number of characters the user can enter. If this parameter is zero, the text length is set to 0x7FFFFFFE characters for single-line edit controls or 0xFFFFFFFF for multiline edit controls.

Return Values

This message does not return a value.

Remarks

The EM_LIMITTEXT message limits only the text the user can enter. It has no effect on any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control by the WM_SETTEXT message. If an application uses the WM_SETTEXT message to place more text into an edit control than is specified in the EM_LIMITTEXT message, the user can edit the entire contents of the edit control.

The default limit to the amount of text a user can enter in an edit control is 30,000 characters.

In a rich edit control, use the message EM_EXLIMITTEXT for text length values greater than 64K.

See Also

EM_EXLIMITTEXT, WM_SETTEXT


 EM_LINEFROMCHAR

An application sends an EM_LINEFROMCHAR message to retrieve the index of the line that contains the specified character index in a multiline edit control. A character index is the number of characters from the beginning of the edit control.

EM_LINEFROMCHAR

wParam = (WPARAM) ich; // character index

lParam = 0; // not used; must be zero

Parameters

ich

Value of wParam. Specifies the character index of the character contained in the line whose number is to be retrieved. If the ich parameter is [image] 1, either the line number of the current line (the line containing the caret) is retrieved or, if there is a selection, the line number of the line containing the beginning of the selection is retrieved.

Return Values

The return value is the zero-based line number of the line containing the character index specified by ich.

Remarks

In a rich edit control, if the character index is greater than 64K, use the message EM_EXLINEFROMCHAR.

See Also

EM_EXLINEFROMCHAR, EM_LINEINDEX


 EM_LINEINDEX

An application sends an EM_LINEINDEX message to retrieve the character index of a line in a multiline edit control. The character index is the number of characters from the beginning of the edit control to the specified line.

EM_LINEINDEX

wParam = (WPARAM) line; // line number

lParam = 0; // not used; must be zero

Parameters

line

Value of wParam. Specifies the zero-based line number. A value of [image] 1 specifies the current line number (the line that contains the caret).

Return Values

The return value is the character index of the line specified in the line parameter, or it is [image] 1 if the specified line number is greater than the number of lines in the edit control.

See Also

EM_LINEFROMCHAR


 EM_LINELENGTH

An application sends an EM_LINELENGTH message to retrieve the length of a line, in characters, in an edit control.

EM_LINELENGTH

wParam = (WPARAM) ich; // character index

lParam = 0; // not used; must be zero

Parameters

ich

Value of wParam. Specifies the character index of a character in the line whose length is to be retrieved when EM_LINELENGTH is sent to a multiline edit control. If this parameter is [image] 1, the message returns the number of unselected characters on lines containing selected characters. For example, if the selection extended from the fourth character of one line through the eighth character from the end of the next line, the return value would be 10 (three characters on the first line and seven on the next).

Return Values

The return value is the length, in characters, of the line specified by the ich parameter when an EM_LINELENGTH message is sent to a multiline edit control. The return value is the length, in characters, of the text in the edit control when an EM_LINELENGTH message is sent to a single-line edit control.

Remarks

Use the EM_LINEINDEX message to retrieve a character index for a given line number within a multiline edit control.

See Also

EM_LINEINDEX


 EM_LINESCROLL

An application sends an EM_LINESCROLL message to scroll the text vertically or horizontally in a multiline edit control.

EM_LINESCROLL

wParam = (WPARAM) cxScroll; // characters to scroll horizontally

lParam = (LPARAM) cyScroll; // lines to scroll vertically

Parameters

cxScroll

Value of wParam. Specifies the number of characters to scroll horizontally.

cyScroll

Value of lParam. Specifies the number of lines to scroll vertically.

Return Values

If the message is sent to a multiline edit control, the return value is TRUE; if the message is sent to a single-line edit control, the return value is FALSE.

Remarks

The edit control does not scroll vertically past the last line of text in the edit control. If the current line plus the number of lines specified by the cyScroll parameter exceeds the total number of lines in the edit control, the value is adjusted so that the last line of the edit control is scrolled to the top of the edit-control window.

The EM_LINESCROLL message can be used to scroll horizontally past the last character of any line.


 EM_PASTESPECIAL

The EM_PASTESPECIAL message pastes a specific clipboard format in a rich edit control.

EM_PASTESPECIAL

wParam = (WPARAM) (UINT) uFormat;

lParam = (REPASTESPECIAL FAR *) lpRePasteSpecial;

Parameters

uFormat

Clipboard format to paste. For a list of clipboard formats, see SetClipboardData.

lpRePasteSpecial

The address of a REPASTESPECIAL structure or NULL. If an object is being pasted in, the REPASTESPECIAL structure is filled in with the desired display aspect. If lParam is NULL or REPASTESPECIAL.dwAspect is zero, the display aspect used will be the contents of the object descriptor.

Return Values

No return value.

See Also

REPASTESPECIAL, SetClipboardData


 EM_POSFROMCHAR

An application sends the EM_POSFROMCHAR message to retrieve the coordinates of the specified character in an edit control.

EM_POSFROMCHAR

wParam = (LPPOINT) lpPoint; // address of structure

// receiving character position

lParam = (LPARAM) wCharIndex; // zero-based index of character

Parameters

lpPoint

Value of wParam. Address of a POINT structure that receives the coordinates of the specified character. The coordinates in the structure locate the upper-left corner of the character. If the wCharIndex is greater than the index of the last character in the control, the returned coordinates are of the position just past the last character of the control. The coordinates are relative to the upper-left corner of the edit control's client area.

wCharIndex

Value of lParam. Specifies the zero-based index of the character.

Return Value

This message does not return a value.

Remarks

For a single-line edit control, the y-coordinate is always zero. A returned coordinate can be negative if the character has been scrolled outside the edit control's client area. The coordinates are truncated to integer values.

See Also

EM_CHARFROMPOS


 EM_REPLACESEL

An application sends an EM_REPLACESEL message to replace the current selection in an edit control with the specified text.

EM_REPLACESEL

fCanUndo = (BOOL) wParam ; // flag that specifies whether replacement can be undone

lpszReplace = (LPCTSTR) lParam ; // pointer to replacement text string

Parameters

fCanUndo

Value of wParam. Specifies whether the replacement operation can be undone. If this is TRUE, the operation can be undone. If this is FALSE , the operation cannot be undone.

lpszReplace

Value of lParam. Points to a null-terminated string containing the replacement text.

Return Values

This message does not return a value.

Remarks

Use the EM_REPLACESEL message to replace only a portion of the text in an edit control. To replace all of the text, use the WM_SETTEXT message.

If there is no current selection, the replacement text is inserted at the current location of the caret.

See Also

WM_SETTEXT


 EM_REQUESTRESIZE

The EM_REQUESTRESIZE message forces a rich edit control to send an EN_REQUESTRESIZE notification message to its parent window.

EM_REQUESTRESIZE

wParam = 0;

lParam = 0;

Return Values

No return value.

Remarks

This message is useful during WM_SIZE processing for the parent of a bottomless rich edit control.

See Also

EN_REQUESTRESIZE, WM_SIZE


 EM_SCROLL

An application sends an EM_SCROLL message to scroll the text vertically in a multiline edit control. This message is equivalent to sending a WM_VSCROLL message to the edit control.

EM_SCROLL

wParam = (WPARAM) (INT) nScroll; // scroll action

lParam = 0; // not used; must be zero

Parameters

nScroll

Value of wParam. Specifies the action the scroll bar is to take. This parameter may be one of the following values:

Value | Meaning
SB_LINEDOWN | Scrolls down one line.
SB_LINEUP | Scrolls up one line.
SB_PAGEDOWN | Scrolls down one page.
SB_PAGEUP | Scrolls up one page.

Return Values

If the message is successful, the high-order word of the return value is TRUE, and the low-order word is the number of lines that the command scrolls. The number returned may not be the same as the actual number of lines scrolled if the scrolling moves to the beginning or the end of the text. If the nScroll parameter specifies an invalid value, the return value is FALSE.

Remarks

An application should use the EM_LINESCROLL message to scroll to a specific line or character position.

An application should use the EM_SCROLLCARET message to scroll the caret into view.

See Also

EM_LINESCROLL, EM_SCROLLCARET, WM_VSCROLL


 EM_SCROLLCARET

An application sends an EM_SCROLLCARET message to scroll the caret into view in an edit control.

EM_SCROLLCARET

wParam = 0 ; // not used now; reserved for future use; must be zero

lParam = 0 ; // not used now; reserved for future use; must be zero

Parameters

wParam

This parameter is currently unused. It is reserved for future use. It should be set to zero.

lParam

This parameter is currently unused. It is reserved for future use. It should be set to zero.

Return Values

The return value is nonzero if the message is sent to an edit control.

Remarks

In previous versions of Windows, scrolling the caret into view was done by specifying wParam = FALSE in the EM_SETSEL message. A Win32-based application should use the EM_SCROLLCARET message to scroll the caret into view.

See Also

EM_SETSEL


 EM_SELECTIONTYPE

The EM_SELECTIONTYPE message determines the selection type for a rich edit control.

EM_SELECTIONTYPE

wParam = 0;

lParam = 0;

Return Values

Returns SEL_EMPTY if the selection is empty, or one or more of the following values:

Value | Contents of the selection
SEL_TEXT | Text
SEL_OBJECT | At least one OLE object
SEL_MULTICHAR | More than one character of text
SEL_MULTIOBJECT | More than one OLE object

Remarks

This message is useful during WM_SIZE processing for the parent of a bottomless rich edit control.

See Also

WM_SIZE


 EM_SETBKGNDCOLOR

The EM_SETBKGNDCOLOR message sets the background color for a rich edit control.

EM_SETBKGNDCOLOR

wParam = (WPARAM) (BOOL) fUseSysColor;

lParam = (LPARAM) (COLORREF) clr;

Parameters

fUseSysColor

Value specifying whether to use the system color. If this parameter is nonzero, the background is set to the window background system color. Otherwise, the background is set to the specified color.

clr

COLORREF structure specifying the color if fUseSysColor is zero.

Return Values

Returns the old background color.

See Also

COLORREF


 EM_SETCHARFORMAT

The EM_SETCHARFORMAT message sets character formatting in a rich edit control.

EM_SETCHARFORMAT

wParam = (WPARAM) (UINT) uFlags;

lParam = (LPARAM) (CHARFORMAT FAR *) lpFmt;

Parameters

uFlags

Character formatting that applies to the control. If this parameter is zero, the default character format is set. Otherwise, it can be one of the following values:

Value | Meaning
SCF_ALL | Applies the formatting to all text in the control.
SCF_SELECTION | Applies the formatting to the current selection. If the selection is empty, the character formatting is applied to the insertion point, and the new character format is in effect only until the insertion point changes.
SCF_WORD | SCF_SELECTION | Applies the formatting to the selected word or words. If the selection is empty but the insertion point is inside a word, the formatting is applied to the word. The SCF_WORD value must be used in conjunction with the SCF_SELECTION value.

lpFmt

Pointer to a CHARFORMAT structure specifying the character formatting to use. Only the formatting attributes specified by the dwMask member are changed.

Return Values

Returns a nonzero value if successful or zero otherwise.

See Also

CHARFORMAT


 EM_SETEVENTMASK

The EM_SETEVENTMASK message sets the event mask for a rich edit control. The event mask specifies which notification messages the control sends to its parent window.

EM_SETEVENTMASK

wParam = 0;

lParam = (LPARAM) (DWORD) dwMask;

Parameters

dwMask

New event mask for the rich edit control.

Return Values

Returns the previous event mask.

Remarks

The default event mask (before any is set) is ENM_NONE.


 EM_SETHANDLE

An application sends an EM_SETHANDLE message to set the handle of the memory that will be used by a multiline edit control.

EM_SETHANDLE

wParam = (WPARAM) (HLOCAL) hloc; // handle of memory buffer

lParam = 0; // not used; must be zero

Parameters

hloc

Value of wParam. Identifies the memory the edit control uses to store the currently displayed text instead of allocating its own memory. If necessary, the control reallocates this memory.

Return Values

This message does not return a value.

Remarks

Before an application sets a new memory handle, it should send an EM_GETHANDLE message to retrieve the handle of the current memory buffer and should free that memory.

An edit control automatically reallocates the given buffer whenever it needs additional space for text, or it removes enough text so that additional space is no longer needed.

Sending an EM_SETHANDLE message clears the undo buffer (EM_CANUNDO returns zero) and the internal modification flag (EM_GETMODIFY returns zero). The edit control window is redrawn.

An application can send this message to a multiline edit control in a dialog box only if it has created the dialog box with the DS_LOCALEDIT style flag set.

See Also

EM_CANUNDO, EM_GETHANDLE, EM_GETMODIFY


 EM_SETIMECOLOR

Sets the IME composition color. This message is available only in Asian-language versions of the operating system.

EM_SETIMECOLOR
wParam = (WPARAM) 0;
lParam = (LPARAM) (COMPCOLOR *) aCompColor;

Parameters

aCompColor

Address of a four-element array of COMPCOLOR structures that contains the composition color to be set.

Return Values

Returns nonzero if successful, zero otherwise.

See Also

EM_GETIMECOLOR, COMPCOLOR


 EM_SETIMEOPTIONS

Sets the IME options. This message is available only in Asian-language versions of the operating system.

EM_SETIMEOPTIONS
wParam = (WPARAM) (UINT) fOperation;
lParam = (LPARAM) (int) fOptions;

Parameters

fOperation

Operation flag. Can be one of the following values:

ECOOP_SET | Set the options to those specified by fOptions.
ECOOP_OR | Combine the specified options with the current options.
ECOOP_AND | Retain only those current options that are also specified by fOptions.
ECOOP_XOR | Logically Exclusive OR the current options with those specified by fOptions.
fOptions

IME option flag. Can be a combination of the following values:

IMF_CLOSESTATUSWINDOW | Closes the IME status window when the control receives the input focus.
IMF_FORCEACTIVE | Activates the IME when the control receives the input focus.
IMF_FORCEDISABLE | Disables the IME when the control receives the input focus.
IMF_FORCEENABLE | Enables the IME when the control receives the input focus.
IMF_FORCEINACTIVE | Inactivates the IME when the control receives the input focus.
IMF_FORCENONE | Disables IME handling.
IMF_FORCEREMEMBER | Restores the previous IME status when the control receives the input focus.
IMF_MULTIPLEEDIT | Specifies that the composition string will not be canceled or determined by focus changes. This allows an application to have separate comosition strings on each rich edit control.

Return Values

Returns nonzero if successful, zero otherwise.

See Also

EM_GETIMEOPTIONS


 EM_SETLIMITTEXT

An application sends the EM_SETLIMITTEXT message to set the text limit for an edit control. The text limit is the maximum amount of text, in bytes, that the edit control can contain.

EM_SETLIMITTEXT

wParam = (WPARAM) cbMax; // new text limits, in bytes

lParam = 0; // not used, must be zero

Parameters

cbMax

Value of wParam. Specifies the new text limit, in bytes. If this parameter is 0, Windows sets the maximum text limit. The maximum text limit is 32,766 bytes for a single-line edit control, and 65,535 bytes for a multiline edit control.

Return Values

This message does not return a value.

Remarks

The EM_SETLIMITTEXT message replaces the EM_LIMITTEXT message.

See Also

EM_GETLIMITTEXT


 EM_SETMARGINS

An application sends the EM_SETMARGINS message to set the widths of the left and right margins for an edit control. The message redraws the control to reflect the new margins.

EM_SETMARGINS

wParam = (WPARAM) fwMargin; // left and/or right margins

lParam = (LPARAM) MAKELONG(wLeft, wRight); // width of left or right margins, in pixels

Parameters

fwMargin

Value of wParam. Specifies the margins to set. This parameter can be a combination of the following values:

Value | Meaning
EC_LEFTMARGIN | Sets the left margin.
EC_RIGHTMARGIN | Sets the right margin.
EC_USEFONTINFO | Uses information about the current font of the edit control to set the margins. For a single-line edit control, margins are set to the average width of characters in the font. For a multiline edit control, the right margin is set to the "A" width of the font (the distance added to the current position before drawing a character), and the left margin is set to the "C" width (the distance added to the current position to provide white space to the right of a character).

If EC_USEFONTINFO is specified, the lParam parameter is ignored.

wLeft

Value of the low-order word of lParam. Specifies the width of the left margin, in pixels. This value is ignored if fwMargin does not include EC_LEFTMARGIN or if EC_USEFONTINFO is specified.

wRight

Value of the high-order word of lParam. Specifies the width of the right margin, in pixels. This value is ignored if fwMargin does not include EC_RIGHTMARGIN or if EC_USEFONTINFO is specified.

Return Values

This message does not return a value.

See Also

EM_GETMARGINS


 EM_SETMODIFY

An application sends an EM_SETMODIFY message to set or clear the modification flag for an edit control. The modification flag indicates whether the text within the edit control has been modified. It is automatically set whenever the user changes the text. An EM_GETMODIFY message can be sent to retrieve the value of the modification flag.

EM_SETMODIFY

wParam = (WPARAM) (UINT) fModified; // modification flag

lParam = 0; // not used; must be zero

Parameters

fModified

Value of wParam. Specifies the new value for the modification flag. A value of TRUE indicates the text has been modified, and a value of FALSE indicates it has not been modified.

Return Values

This message does not return a value.

Remarks

In a rich edit control, objects created without the REO_DYNAMICSIZE flag will lock in their extents when the modify flag is set to FALSE.

See Also

EM_GETMODIFY, REOBJECT


 EM_SETOLEINTERFACE

The EM_SETOLEINTERFACE message gives a rich edit control an IRichEditOleCallback object that the control uses to get OLE-related resources and information from the client.

EM_SETOLEINTERFACE

wParam = 0;

lParam = (LPARAM) (IRichEditOleCallback FAR *) lpObj;

Parameters

lpObj

Pointer to an IRichEditOleCallback object. The control calls the AddRef function for the object before returning.

Return Values

Returns a nonzero value if successful or zero otherwise.


 EM_SETOPTIONS

Sets the options for a rich edit control.

EM_SETOPTIONS
wParam = (WPARAM) (UINT) fOperation;
lParam = (LPARAM) (UINT) fOptions;

Parameters

fOperation

Operation flag. Can be one of these values:

ECOOP_SET | Set the options to those specified by fOptions.
ECOOP_OR | Combine the specified options with the current options.
ECOOP_AND | Retain only those current options that are also specified by fOptions.
ECOOP_XOR | Logically Exclusive OR the current options with those specified by fOptions.

fOptions

Rich edit control options. Can be a combination of these values:

Value | Meaning
ECO_AUTOWORDSELECTION | Automatic selection of word on doubleclick.
ECO_AUTOVSCROLL | Same as ES_AUTOVSCROLL style.
ECO_AUTOHSCROLL | Same as ES_AUTOHSCROLL style.
ECO_NOHIDESEL | Same as ES_NOHIDESEL style.
ECO_READONLY | Same as ES_READONLY style.
ECO_WANTRETURN | Same as ES_WANTRETURN style.
ECO_SAVESEL | Same as ES_SAVESEL style.
ECO_SELECTIONBAR | Same as ES_SELECTIONBAR style.
ECO_VERTICAL | Same as ES_VERTICAL style. Available in Asian-language versions only.

Return Values

Returns current option of edit control.


 EM_SETPARAFORMAT

The EM_SETPARAFORMAT message sets the paragraph formatting for the current selection in a rich edit control.

EM_SETPARAFORMAT

wParam = 0; // not used; must be zero

lParam = (LPARAM) (PARAFORMAT FAR *) lpFmt;

Parameters

lpFmt

Pointer to a PARAFORMAT structure specifying the new paragraph formatting attributes. Only the attributes specified by the dwMask member are changed.

Return Values

Returns a nonzero value if successful, or zero otherwise.

See Also

PARAFORMAT


 EM_SETPASSWORDCHAR

An application sends an EM_SETPASSWORDCHAR message to set or remove the password character for a single-line edit control when the user types text. When a password character is set, that character is displayed in place of each character the user types.

EM_SETPASSWORDCHAR

wParam = (WPARAM) (UINT) ch; // character to display

lParam = 0; // not used; must be zero

Parameters

ch

Value of wParam. Specifies the character to be displayed in place of the character typed by the user. If this parameter is zero, the characters typed by the user are displayed.

Return Values

This message does not return a value.

Remarks

When the EM_SETPASSWORDCHAR message is received by an edit control, the edit control redraws all visible characters by using the character specified by the ch parameter.

If the edit control is created with the ES_PASSWORD style, the default password character is set to an asterisk (*). This style is removed if an EM_SETPASSWORDCHAR message is sent with the ch parameter set to zero.

See Also

EM_GETPASSWORDCHAR


 EM_SETPUNCTUATION

Sets the punctuation characters for a rich edit control. This message is available only in Asian-language versions of the operating system.

EM_SETPUNCTUATION
wParam = (WPARAM) (UINT) fType;
lParam = (LPARAM) (PUNCTUATION FAR *) punctTable;

Parameters

fType

Punctuation type flag. Can be one of the following values:

Value | Meaning
PC_LEADING | Leading punctuation characters.
PC_FOLLOWING | Following punctuation characters.
PC_DELIMITER | Delimiter.

The PC_OVERFLOW value is not supported.

punctTable

Address of a PUNCTUATION structure that contains the punctuation characters.

Return Values

Returns nonzero if successful; zero otherwise.

See Also

PUNCTUATION


 EM_SETREADONLY

An application sends an EM_SETREADONLY message to set or remove the read-only style (ES_READONLY) of an edit control.

EM_SETREADONLY

wParam = (WPARAM) (BOOL) fReadOnly; // read-only flag

lParam = 0; // not used; must be zero

Parameters

fReadOnly

Value of wParam. Specifies whether to set or remove the ES_READONLY style. A value of TRUE sets the ES_READONLY style; a value of FALSE removes the ES_READONLY style.

Return Values

If the operation succeeds, the return value is nonzero; otherwise, it is zero.

Remarks

When an edit control has the ES_READONLY style, the user cannot change the text within the edit control.

To determine whether an edit control has the ES_READONLY style, use the GetWindowLong function with the GWL_STYLE flag.

See Also

GetWindowLong


 EM_SETRECT

An application sends an EM_SETRECT message to set the formatting rectangle of a multiline edit control. The formatting rectangle is the limiting rectangle of the text. The limiting rectangle is independent of the size of the edit control window. When the edit control is first created, the formatting rectangle is the same as the client area of the edit control window. By using the EM_SETRECT message, an application can make the formatting rectangle larger or smaller than the edit control window.

This message is processed only by multiline edit controls.

EM_SETRECT

wParam = 0; // not used; must be zero

lParam = (LPARAM) (LPRECT) lprc; // address of new rectangle

Parameters

lprc

Value of lParam. Points to a RECT structure that specifies the new dimensions of the rectangle.

Return Values

This message does not return a value.

Remarks

The EM_SETRECT message causes the text of the edit control to be redrawn. To change the size of the formatting rectangle without redrawing the text, use the EM_SETRECTNP message.

If the edit control does not have a horizontal scroll bar, and the formatting rectangle is set to be larger than the edit control window, lines of text exceeding the width of the edit control window (but smaller than the width of the formatting rectangle) are clipped instead of wrapped.

If the edit control contains a border, the formatting rectangle is reduced by the size of the border. If you are adjusting the rectangle returned by an EM_GETRECT message, you must remove the size of the border before using the rectangle with the EM_SETRECT message.

See Also

EM_GETRECT, EM_SETRECTNP, RECT


 EM_SETRECTNP

An application sends an EM_SETRECTNP message to set the formatting rectangle of a multiline edit control. The formatting rectangle is the limiting rectangle of the text. The limiting rectangle is independent of the size of the edit control window. When the edit control is first created, the formatting rectangle is the same as the client area of the edit control window. By using the EM_SETRECTNP message, an application can make the formatting rectangle larger or smaller than the edit control window.

The EM_SETRECTNP message is identical to the EM_SETRECT message, except that the edit control window is not redrawn.

This message is processed only by multiline edit controls.

EM_SETRECTNP

wParam = 0; // not used; must be zero

lParam = (LPARAM) (LPRECT) lprc; // address of new rectangle

Parameters

lprc

Value of lParam. Points to a RECT structure that specifies the new dimensions of the rectangle.

Return Values

This message does not return a value.

See Also

EM_SETRECT, RECT


 EM_SETSEL

An application sends an EM_SETSEL message to select a range of characters in an edit control.

EM_SETSEL

wParam = (WPARAM) (INT) nStart; // starting position

lParam = (LPARAM) (INT) nEnd; // ending position

Parameters

nStart

Value of wParam. Specifies the starting character position of the selection.

nEnd

Specifies the ending character position of the selection.

Return Values

This message does not return a value.

Remarks

In a rich edit control, if the selection is not entirely contained in the first 64K, use the message EM_EXSETSEL.

If the nStart parameter is 0 and the nEnd parameter is [image] 1, all the text in the edit control is selected. If nStart is [image] 1, any current selection is removed. The caret is placed at the end of the selection indicated by the greater of the two values nEnd and nStart.

In previous versions of Windows, the wParam parameter is a flag that is set to FALSE to scroll the caret into view or set to TRUE to omit the scrolling. A Win32-based application should use the EM_SCROLLCARET message to scroll the caret into view.

In earlier versions of Windows, the starting and ending positions of the selection are indicated by the low- and high-order words, respectively, of the lParam parameter.

See Also

EM_GETSEL, EM_REPLACESEL, EM_SCROLLCARET, EM_EXSETSEL


 EM_SETTABSTOPS

An application sends an EM_SETTABSTOPS message to set the tab stops in a multiline edit control. When text is copied to the control, any tab character in the text causes space to be generated up to the next tab stop.

This message is processed only by multiline edit controls.

EM_SETTABSTOPS

wParam = (WPARAM) cTabs; // number of tab stops

lParam = (LPARAM) (LPDWORD) lpdwTabs; // tab stop array

Parameters

cTabs

Value of wParam. Specifies the number of tab stops contained in the lpdwTabs parameter. If this parameter is zero, the lpdwTabs parameter is ignored and default tab stops are set at every 32 dialog box units. If this parameter is 1, tab stops are set at every n dialog box units, where n is the distance pointed to by the ldpwTabs parameter. If the cTabs parameter is greater than 1, lpdwTabs points to an array of tab stops.

lpdwTabs

Value of lParam. Points to an array of unsigned integers specifying the tab stops, in dialog units. If the cTabs parameter is 1, lpdwTabs points to an unsigned integer containing the distance between all tab stops, in dialog box units.

Return Values

If all the tabs are set, the return value is TRUE; otherwise, it is FALSE.

Remarks

The EM_SETTABSTOPS message does not automatically redraw the edit control window. If the application is changing the tab stops for text already in the edit control, it should call the InvalidateRect function to redraw the edit control window.

See Also

GetDialogBaseUnits, InvalidateRect


 EM_SETTARGETDEVICE

The EM_SETTARGETDEVICE message sets the target device and line width used for WYSIWYG (what you see is what you get) formatting in a rich edit control.

EM_SETTARGETDEVICE

wParam = (WPARAM) (HDC) hdcTarget;

lParam = (LPARAM) (int) cxLineWidth;

Parameters

hdcTarget

Handle to a device context for the target device.

cxLineWidth

Line width to use for formatting.

Return Values

Returns a nonzero value if successful or zero otherwise.


 EM_SETWORDBREAK

The EM_SETWORDBREAK message is not supported. Applications that must replace the default wordwrap function of a multiline edit control with an application-defined wordwrap function should use the EM_SETWORDBREAKPROC message.


 EM_SETWORDBREAKPROC

An application sends the EM_SETWORDBREAKPROC message to an edit control to replace the default wordwrap function with an application-defined wordwrap function.

EM_SETWORDBREAKPROC

wParam = 0; // not used; must be zero

lParam = (LPARAM)(EDITWORDBREAKPROC)ewbprc; // function address

Parameters

ewbprc

Value of lParam. Specifies the address of the application-defined wordwrap function. For more information about breaking lines, see the description of the EditWordBreakProc callback function.

Return Values

This message does not return a value.

Remarks

A wordwrap function scans a text buffer that contains text to be sent to the screen, looking for the first word that does not fit on the current screen line. The wordwrap function places this word at the beginning of the next line on the screen.

A wordwrap function defines the point at which Windows should break a line of text for multiline edit controls, usually at a space character that separates two words. Either a multiline or a single-line edit control might call this function when the user presses arrow keys in combination with the CTRL key to move the caret to the next word or previous word. The default wordwrap function breaks a line of text at a space character. The application-defined function may define the wordwrap to occur at a hyphen or a character other than the space character.

See Also

EditWordBreakProc, EM_FMTLINES, EM_GETWORDBREAKPROC


 EM_SETWORDBREAKPROCEX

Sets the extended word-break procedure.

EM_SETWORDBREAKPROCEX
wParam = (WPARAM) 0;
lParam = (LPARAM) pfnWordBreakProcEx;

Parameters

pfnWordBreakprocEx

Address of an EditWordBreakProcEx function or NULL to use the default procedure.

Return Values

Returns the address of the previous extended word-break procedure.

See Also

EditWordBreakProcEx, EM_GETWORDBREAKPROCEX


 EM_SETWORDWRAPMODE

Sets the word-wrapping and word-breaking options for the rich edit control. This message is available only in Asian-language versions of the operating system.

EM_SETWORDWRAPMODE
wParam = (WPARAM) (UINT) fOptions;
lParam = (LPARAM) 0:

Parameters

fOptions

Options flag. Can be a combination of the following values:

Value | Meaning
WBF_WORDWRAP | Enables Asian-specific word-wrap operation, such as Kinsoku in Japanese.
WBF_WORDBREAK | Enables English word-breaking operation in Japanese and Chinese. Enables Hangeul word-breaking operation.
WBF_OVERFLOW | Recognizes overflow punctuation. (Not currently supported.)
WBF_LEVEL1 | Sets level 1 punctuation table as default.
WBF_LEVEL2 | Sets level 2 punctuation table as default.
WBF_CUSTOM | Sets application-defined punctuation table.

Return Values

Returns the current word-wrapping and word-breaking options.

Remarks

This message must not be sent by the application-defined word-breaking procedure.


 EM_STREAMIN

The EM_STREAMIN message replaces the contents of a rich edit control with the specified data stream.

EM_STREAMIN

wParam = (WPARAM) (UINT) uFormat;

lParam = (LPARAM) (EDITSTREAM FAR *) lpStream;

Parameters

uFormat

One of the following data formats:

Value | Meaning
SF_TEXT | Text
SF_RTF | Rich Text Format (RTF)

Both data formats may be combined with the SFF_SELECTION flag. If the SFF_SELECTION flag is specified, the stream replaces the contents of the current selection. Otherwise, the stream replaces the entire contents of the control.

The SF_RTF format may be combined with the SFF_PLAINRTF flag. If the SFF_PLAINRTF flag is specified, language-specific RTF keywords in the stream are ignored. Only keywords common to all languages are streamed in.

lpStream

Pointer to an EDITSTREAM structure. The control reads (streams in) the data by repeatedly calling the function specified by the structure's pfnCallback member.

Return Values

Returns the number of characters read.

See Also

EDITSTREAM


 EM_STREAMOUT

The EM_STREAMOUT message writes (streams out) the contents of a rich edit control to the specified data stream.

EM_STREAMOUT

wParam = (WPARAM) (UINT) uFormat;

lParam = (LPARAM) (EDITSTREAM FAR *) lpStream;

Parameters

uFormat

Value specifying one of the following data formats:

Value | Meaning
SF_TEXT | Text with spaces in place of OLE objects
SF_RTF | Rich Text Format (RTF)
SF_RTFNOOBJS | RTF with spaces in place of OLE object.
SF_TEXTIZED | Text with a text representation of OLE objects.

The SF_RTFNOOBJS option is useful if an application stores OLE objects itself, as RTF representation of OLE objects is not very compact. The control word \objattph followed by a space denotes the object position.

All data formats may be combined with the SFF_SELECTION flag. If the SFF_SELECTION flag is specified, only the contents of the current selection are streamed out. Otherwise, the entire contents of the control are streamed out.

The SF_RTF and SF_RTFNOOBJS formats may be combined with the SFF_PLAINRTF flag. If the SFF_PLAINRTF flag is specified, language-specific RTF keywords are ignored. Only keywords common to all languages are streamed out.

lpStream

Pointer to an EDITSTREAM structure. The control streams out the data by repeatedly calling the function specified by the structure's pfnCallback member.

Return Values

Returns the number of characters written to the data stream.

See Also

EDITSTREAM


 EM_UNDO

An application sends an EM_UNDO message to undo the last edit control operation.

EM_UNDO

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

For a single-line edit control, the return value is always TRUE. For a multiline edit control, the return value is TRUE if the undo operation is successful, or FALSE if the undo operation fails.

Remarks

An undo operation can also be undone. For example, you can restore deleted text with the first EM_CANUNDO message, and remove the text again with a second EM_CANUNDO message as long as there is no intervening edit operation.

See Also

EM_CANUNDO


 EmptyClipboard

The EmptyClipboard function empties the clipboard and frees handles to data in the clipboard. The function then assigns ownership of the clipboard to the window that currently has the clipboard open.

BOOL EmptyClipboard(VOID)

Parameters

This function has no parameters.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError .

Remarks

Before calling EmptyClipboard, an application must open the clipboard by using the OpenClipboard function. If the application specifies a NULL window handle when opening the clipboard, EmptyClipboard succeeds but sets the clipboard owner to NULL.

See Also

OpenClipboard, SetClipboardData , WM_DESTROYCLIPBOARD


 EMR

The EMR structure provides the base structure for all enhanced metafile records. An enhanced metafile record contains the parameters for a specific GDI function used to create part of a picture in an enhanced format metafile.

typedef struct tagEMR
{
DWORD iType;

DWORD nSize;
} EMR, *PEMR;

Members

iType

Specifies the record type.

nSize

Size of the record, in bytes. This member must be a multiple of four.


 EMRANGLEARC

The EMRANGLEARC structure contains members for the AngleArc enhanced metafile record.

typedef struct tagEMRANGLEARC
{
EMR emr;
POINTL ptlCenter;

DWORD nRadius;
FLOAT eStartAngle;
FLOAT eSweepAngle;
} EMRANGLEARC, *PEMRANGLEARC;

Members

emr

Base structure for all record types.

ptlCenter

Logical coordinates of circle's center.

nRadius

Circle's radius, in logical units.

eStartAngle

Arc's start angle, in degrees.

eSweepAngle

Arc's sweep angle, in degrees.

See Also

AngleArc


 EMRARC, EMRARCTO, EMRCHORD, EMRPIE

The EMRARC, EMRARCTO, EMRCHORD, and EMRPIE structures contain members for the Arc , ArcTo , Chord , and Pie enhanced metafile records.

typedef struct tagEMRARC
{
EMR emr;

RECTL rclBox;
POINTL ptlStart;
POINTL ptlEnd;
} EMRARC, *PEMRARC,
EMRARCTO, *PEMRARCTO,
EMRCHORD, *PEMRCHORD,
EMRPIE, *PEMRPIE;

Members

emr

Base structure for all record types.

rclBox

Bounding rectangle.

ptlStart

Coordinates of first radial ending point.

ptlEnd

Coordinates of second radial ending point.

See Also

Arc, ArcTo , Chord , Pie


 EMRBITBLT

The EMRBITBLT structure contains members for the BitBlt enhanced metafile record. Note that graphics device interface (GDI) converts the device-dependent bitmap into a device-independent bitmap (DIB) before storing it in the metafile record.

typedef struct tagEMRBITBLT
{
EMR emr;

RECTL rclBounds;

LONG xDest;

LONG yDest;

LONG cxDest;

LONG cyDest;

DWORD dwRop;

LONG xSrc;

LONG ySrc;

XFORM xformSrc;

COLORREF crBkColorSrc;

DWORD iUsageSrc;

DWORD offBmiSrc;

DWORD offBitsSrc;

DWORD cbBitsSrc;

} EMRBITBLT, *PEMRBITBLT;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

xDest

Logical x-coordinate of the upper-left corner of the destination rectangle.

yDest

Logical y-coordinate of the upper-left corner of the destination rectangle.

dwRop

Raster-operation code. These codes define how the color data of the source rectangle is to be combined with the color data of the destination rectangle to achieve the final color.

xSrc

Logical x-coordinate of the upper-left corner of the source rectangle.

ySrc

Logical y-coordinate of the upper-left corner of the source rectangle.

xformSrc

World-space to page-space transformation of the source device context.

crBkColorSrc

Background color (the RGB value) of the source device context.

iUsageSrc

Value of the bmiColors member of the BITMAPINFO structure. The iUsageSrc member can be either the DIB_PAL_COLORS, DIB_PAL_INDICES or DIB_RGB_COLORS value.

offBmiSrc

Offset to source BITMAPINFO structure.

cbBmiSrc

Size of source BITMAPINFO structure.

offBitsSrc

Offset to source bitmap bits.

cbBitsSrc

Size of source bitmap bits.

See Also

BitBlt, BITMAPINFO , RGB


 EMRCREATEBRUSHINDIRECT

The EMRCREATEBRUSHINDIRECT structure contains members for the CreateBrushIndirect enhanced metafile record.

typedef struct tagEMRCREATEBRUSHINDIRECT
{
EMR emr;

DWORD ihBrush;

LOGBRUSH lb;

} EMRCREATEBRUSHINDIRECT, *PEMRCREATEBRUSHINDIRECT;

Members

emr

Base structure for all record types.

ihBrush

Index of brush in handle table.

lb

LOGBRUSH structure containing information about the brush. The lbStyle member must be either the BS_SOLID, BS_HOLLOW, BS_NULL, or BS_HATCHED value.

See Also

CreateBrushIndirect, LOGBRUSH


 EMRCREATECOLORSPACE

The EMRCREATECOLORSPACE structure contains members for the CreateColorSpace enhanced metafile record.

typedef struct tagEMRCREATECOLORSPACE
{
EMR emr;

DWORD ihCS;

LOGCOLORSPACE lcs;

} EMRCREATECOLORSPACE, *PEMRCREATECOLORSPACE;

Members

emr

Base structure for all record types

ihCS

Index of the color cpace in handle table

lcs

Logical color space

See Also

CreateColorSpace


 EMRCREATEDIBPATTERNBRUSHPT

The EMRCREATEDIBPATTERNBRUSHPT structure contains members for the CreateDIBPatternBrushPt enhanced metafile record. The BITMAPINFO structure is followed by the bitmap bits that form a packed device-independent bitmap (DIB).

typedef struct tagEMRCREATEDIBPATTERNBRUSHPT
{
EMR emr;

DWORD ihBrush;

DWORD iUsage;

DWORD offBmi;

DWORD cbBmi;

DWORD offBits;

DWORD cbBits;

} EMRCREATEDIBPATTERNBRUSHPT,
PEMRCREATEDIBPATTERNBRUSHPT;

Members

emr

Base structure for all record types.

ihBrush

Index of brush in handle table.

iUsage

Value specifying whether the bmiColors member of the BITMAPINFO structure was provided and, if so, whether bmiColors contains explicit red, green, blue (RGB) values or indices. The iUsage member must be either the DIB_PAL_COLORS, DIB_PAL_INDICES, or DIB_RGB_COLORS value.

offBmi

Offset to BITMAPINFO structure.

cbBmi

Size of BITMAPINFO structure.

offBits

Offset to bitmap bits.

cbBits

Size of bitmap bits.

See Also

BITMAPINFO, CreateDIBPatternBrushPt , RGB


 EMRCREATEMONOBRUSH

The EMRCREATEMONOBRUSH structure contains members for the CreatePatternBrush (when passed a monochrome bitmap) or CreateDIBPatternBrush (when passed a monochrome DIB) enhanced metafile records.

typedef struct tagEMRCREATEMONOBRUSH
{
EMR emr;

DWORD ihBrush;

DWORD iUsage;

DWORD offBmi;

DWORD cbBmi;

DWORD offBits;

DWORD cbBits;

} EMRCREATEMONOBRUSH, *PEMRCREATEMONOBRUSH;

Members

emr

Base structure for all record types.

ihBrush

Index of brush in handle table.

iUsage

Value specifying whether the bmiColors member of the BITMAPINFO structure was provided and, if so, whether bmiColors contains explicit red, green, blue (RGB) values or indices. The iUsage member must be either the DIB_PAL_COLORS, DIB_PAL_INDICES, or DIB_RGB_COLORS value.

offBmi

Offset to BITMAPINFO structure.

cbBmi

Size of BITMAPINFO structure.

offBits

Offset to bitmap bits.

cbBits

Size of bitmap bits.

See Also

BITMAPINFO, CreateDIBPatternBrush , CreatePatternBrush , RGB


 EMRCREATEPALETTE

The EMRCREATEPALETTE structure contains members for the CreatePalette enhanced metafile record.

typedef struct tagEMRCREATEPALETTE
{
EMR emr;

DWORD ihPal;

LOGPALETTE lgpl;

} EMRCREATEPALETTE, *PEMRCREATEPALETTE;

Members

emr

Base structure for all record types.

ihPal

Index of palette in handle table.

lgpl

LOGPALETTE structure that contains information about the palette. Note that peFlags members in the PALETTEENTRY structures do not contain any flags.

See Also

CreatePalette, LOGPALETTE , PALETTEENTRY


 EMRCREATEPEN

The EMRCREATEPEN structure contains members for the CreatePen enhanced metafile record.

typedef struct tagEMRCREATEPEN
{
EMR emr;

DWORD ihPen;

LOGPEN lopn;

} EMRCREATEPEN, *PEMRCREATEPEN;

Members

emr

Base structure for all record types

ihPen

Index to pen in handle table

lopn

Logical pen

See Also

CreatePen


 EMRELLIPSE, EMRRECTANGLE

The EMRELLIPSE and EMARRECTANGLE structures contain members for the Ellipse and Rectangle enhanced metafile records.

typedef struct tagEMRELLIPSE
{
EMR emr;

RECTL rclBox;

} EMRELLIPSE, *PEMRELLIPSE,
EMRRECTANGLE, *PEMRRECTANGLE;

Members

emr

Base structure for all record types.

rclBox

Bounding rectangle.

See Also

Ellipse, Rectangle


 EMREOF

The EMREOF structure contains data for the enhanced metafile record that indicates the end of the metafile.

typedef struct tagEMREOF
{
EMR emr;
DWORD nPalEntries;

DWORD offPalEntries;

DWORD nSizeLast;

} EMREOF, *PEMREOF;

Members

emr

Base structure for all record types.

nPalEntries

Number of palette entries.

offPalEntires

Offset to palette entries.

nSizeLast

Same size as the nSize member of the EMR structure. This member must be the last doubleword of the record. If palette entries exist, they precede this member.

See Also

EMR


 EMREXCLUDECLIPRECT, EMRINTERSECTCLIPRECT

The EMREXCLUDECLIPRECT and EMRINTERSECTCLIPRECTstructures contain members for the ExcludeClipRect and IntersectClipRect enhanced metafile records.

typedef struct tagEMREXCLUDECLIPRECT
{
EMR emr; // base structure for all record types
RECTL rclClip; // clipping rectangle
} EMREXCLUDECLIPRECT, *PEMREXCLUDECLIPRECT,
EMRINTERSECTCLIPRECT, *PEMRINTERSECTCLIPRECT;

Members

emr

Base structure for all record types.

rclClip

Clipping rectangle.

ExcludeClipRect , IntersectClipRect


 EMREXTCREATEFONTINDIRECTW

The EMREXTCREATEFONTINDIRECTW structure contains members for the CreateFontIndirect enhanced metafile record.

typedef struct tagEMREXTCREATEFONTINDIRECTW
{
EMR emr;

DWORD ihFont;

EXTLOGFONTW elfw;

} EMREXTCREATEFONTINDIRECTW,
PEMREXTCREATEFONTINDIRECTW;

Members

emr

Base structure for all record types.

ihFont

Index to the font in handle table.

elfw

Logical font.

See Also

CreateFontIndirect


 EMREXTCREATEPEN

The EMREXTCREATEPEN structure contains members for the ExtCreatePen enhanced metafile record. If the record contains a BITMAPINFO structure, it is followed by the bitmap bits that form a packed device-independent bitmap (DIB).

typedef struct tagEMREXTCREATEPEN
{
EMR emr;

DWORD ihPen;

DWORD offBmi;

DWORD cbBmi;

DWORD offBits;

DWORD cbBits;

EXTLOGPEN elp;

} EMREXTCREATEPEN, *PEMREXTCREATEPEN;

Members

emr

Base structure for all record types.

ihPen

Index to pen in handle table.

offBmi

Offset to BITMAPINFO structure, if any.

cbBmi

Size of BITMAPINFO structure, if any.

offBits

Offset to brush bitmap bits, if any.

cbBits

Size of brush bitmap bits, if any.

elp

Extended logical pen, including the elpStyleEntry member of the EXTLOGPEN structure.

See Also

BITMAPINFO, ExtCreatePen , EXTLOGPEN


 EMREXTFLOODFILL

The EMREXTFLOODFILL structure contains members for the ExtFloodFill enhanced metafile record.

typedef struct tagEMREXTFLOODFILL
{
EMR emr;

POINTL ptlStart;

COLORREF crColor;

DWORD iMode;

} EMREXTFLOODFILL, *PEMREXTFLOODFILL;

Members

emr

Base structure for all record types.

ptlStart

Coordinates where filling begins.

crColor

Color of fill.

iMode

Type of fill operation to be performed. This member must be either the FLOODFILLBORDER or FLOODFILLSURFACE value.

See Also

ExtFloodFill


 EMREXTSELECTCLIPRGN

The EMREXTSELECTCLIPRGN structure contains members for the ExtSelectClipRgn enhanced metafile record.

typedef struct tagEMREXTSELECTCLIPRGN
{
EMR emr;

DWORD cbRgnData;

DWORD iMode;

BYTE RgnData[1]; //

} EMREXTSELECTCLIPRGN, *PEMREXTSELECTCLIPRGN;

Members

emr

Base structure for all record types.

cbRgnData

Size of region data, in bytes.

iMode

Operation to be performed. This member must be one of the following values: RGN_AND, RGN_COPY, RGN_DIFF, RGN_OR, or RGN_XOR.

See Also

ExtSelectClipRgn


 EMREXTTEXTOUTA, EMREXTTEXTOUTW

The EMREXTTEXTOUTA and EMREXTTEXTOUTW structures contain members for the ExtTextOut , TextOut , or DrawText enhanced metafile records.

typedef struct tagEMREXTTEXTOUTA
{
EMR emr;

RECTL rclBounds;

DWORD iGraphicsMode;

FLOAT exScale;

FLOAT eyScale;
EMRTEXT emrtext;

} EMREXTTEXTOUTA, *PEMREXTTEXTOUTA,
EMREXTTEXTOUTW, *PEMREXTTEXTOUTW;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

iGraphicsMode

Current graphics mode. This member can be either the GM_COMPATIBLE or GM_ADVANCED value.

exScale

X-scaling factor from page units to .01mm units if the graphics mode is the GM_COMPATIBLE value.

eyScale

Y-scaling factor from page units to .01mm units if the graphics mode is the GM_COMPATIBLE value.

emrtext

EMRTEXT structure, which is followed by the string and the intercharacter spacing array.

See Also

DrawText, ExtTextOut , TextOut , EMRTEXT


 EMRFILLPATH, EMRSTROKEANDFILLPATH, EMRSTROKEPATH

The EMRFILLPATH, EMRSTROKEANDFILLPATH, and EMRSTROKEPATH structures contain members for the FillPath , StrokeAndFillPath , and StrokePath enhanced metafile records.

typedef struct tagEMRFILLPATH
{
EMR emr;

RECTL rclBounds;

} EMRFILLPATH, *PEMRFILLPATH,
EMRSTROKEANDFILLPATH, *PEMRSTROKEANDFILLPATH,
EMRSTROKEPATH, *PEMRSTROKEPATH;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

See Also

FillPath, StrokeAndFillPath , StrokePath


 EMRFILLRGN

The EMRFILLRGN structure contains members for the FillRgn enhanced metafile record.

typedef struct tagEMRFILLRGN
{
EMR emr;

RECTL rclBounds;

DWORD cbRgnData;

DWORD ihBrush;

BYTE RgnData[1];

} EMRFILLRGN, *PEMRFILLRGN;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

cbRgnData

Size of region data, in bytes.

ihBrush

Index of brush, in handle table.

RgnData

Buffer containing RGNDATA structure.

See Also

FillRgn, RGNDATA


 EMRFORMAT

The EMRFORMAT structure contains information that identifies graphics data in an enhanced metafile. A GDICOMMENT_MULTIFORMATS enhanced metafile public comment contains an array of EMRFORMAT structures.

typedef struct tagEMRFORMAT {

DWORD dSignature;

DWORD nVersion;

DWORD cbData;

DWORD offData;

} EMRFORMAT;

Members

dSignature

Contains a picture format identifier. The following identifier values are defined:

Identifier | Meaning
ENHMETA_SIGNATURE | The picture is in enhanced metafile format.
0x46535045 | The picture is in encapsulated PostScript file format.

nVersion

Contains a picture version number. The following version number value is defined:

Version
Meaning

This is the version number of a level 1 encapsulated PostScript file.

cbData

Specifies the size, in bytes, of the picture data.

offData

Specifies an offset to the picture data. The offset is figured from the start of the GDICOMMENT_MULTIFORMATS public comment within which this EMRFORMAT structure is embedded. The offset must be a DWORD offset.

Remarks

GdiComment discusses enhanced metafile public comments in general, and the GDICOMMENT_MULTIFORMATS public comment in particular.

See Also

GdiComment


 EMRFRAMERGN

The EMRFRAMERGN structure contains members for the FrameRgn enhanced metafile record.

typedef struct tagEMRFRAMERGN
{
EMR emr;

RECTL rclBounds;

DWORD cbRgnData;

DWORD ihBrush;

SIZEL szlStroke;

BYTE RgnData[1];

} EMRFRAMERGN, *PEMRFRAMERGN;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

cbRgnData

Size of region data, in bytes.

ihBrush

Index of brush, in handle table.

szlStroke

Width and height of region frame.

RgnData

Buffer containing RGNDATA structure.

See Also

FrameRgn, RGNDATA


 EMRGDICOMMENT

The EMRGDICOMMENT structure contains application-specific data. This enhanced metafile record is only meaningful to applications that know the format of the data and how to utilize it. This record is ignored by graphics device interface (GDI) during playback of the enhanced metafile.

typedef struct tagEMRGDICOMMENT
{
EMR emr;

DWORD cbData;

BYTE Data[1];

} EMRGDICOMMENT, *PEMRGDICOMMENT;

Members

emr

Base structure for all record types.

cbData

Size of data buffer, in bytes.

Data[1]

Application-specific data.


 EMRINVERTRGN, EMRPAINTRGN

The EMRINVERTRGN and EMRPAINTRGN structures contain members for the InvertRgn and PaintRgn enhanced metafile records.

typedef struct tagEMRINVERTRGN
{
EMR emr;

RECTL rclBounds;

DWORD cbRgnData;

BYTE RgnData[1];

} EMRINVERTRGN, *PEMRINVERTRGN,
EMRPAINTRGN, *PEMRPAINTRGN;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

cbRgnData

Size of region data, in bytes.

RgnData

Buffer containing RGNDATA structure.

See Also

InvertRgn, PaintRgn


 EMRLINETO, EMRMOVETOEX

The EMRLINETO and EMRMOVETOEX structures contains members for the LineTo and MoveToEx enhanced metafile records.

typedef struct tagEMRLINETO
{
EMR emr;

POINTL ptl;

} EMRLINETO, *PEMRLINETO,
EMRMOVETOEX, *PEMRMOVETOEX;

Members

emr

Base structure for all record types.

ptl

Coordinates of the line's ending point for the LineTo function or coordinates of the new current position for the MoveToEx function.

See Also

LineTo, MoveToEx


 EMRMASKBLT

The EMRMASKBLT structure contains members for the MaskBlt enhanced metafile record. Note that graphics device interface (GDI) converts the device-dependent bitmap into a device-independent bitmap (DIB) before storing it in the metafile record.

typedef struct tagEMRMASKBLT
{
EMR emr;

RECTL rclBounds;

LONG xDest;

LONG yDest;

LONG cxDest;

LONG cyDest;

DWORD dwRop;

LONG xSrc;

LONG ySrc;

XFORM xformSrc;

COLORREF crBkColorSrc;

DWORD iUsageSrc;

DWORD offBmiSrc;

DWORD cbBmiSrc;

DWORD offBitsSrc;

DWORD cbBitsSrc;

LONG xMask;

LONG yMask;

DWORD iUsageMask;

DWORD offBmiMask;

DWORD cbBmiMask;

DWORD offBitsMask;

DWORD cbBitsMask;

} EMRMASKBLT, *PEMRMASKBLT;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

xDest

Logical x-coordinate of the upper-left corner of the destination rectangle.

yDest

Logical y-coordinate of the upper-left corner of the destination rectangle.

cxDest

Logical width of destination rectangle

cyDest

Logical height of destination rectangle

dwRop

Raster-operation code. These codes define how the color data of the source rectangle is to be combined with the color data of the destination rectangle to achieve the final color.

xSrc

Logical x-coordinate of the upper-left corner of the source rectangle.

ySrc

Logical y-coordinate of the upper-left corner of the source rectangle.

xformSrc

World-space to page-space transformation of the source device context.

crBkColorSrc

Background color (the RGB value) of the source device context.

iUsageSrc

Value of the bmiColors member of the source BITMAPINFO structure. The iUsageSrc member can be either the DIB_PAL_COLORS, DIB_PAL_INDICES, or DIB_RGB_COLORS value.

offBmiSrc

Offset to source BITMAPINFO structure.

cbBmiSrc

Size of source BITMAPINFO structure.

offBitsSrc

Offset to source bitmap bits.

cbBitsSrc

Size of source bitmap bits.

xMask

Horizontal pixel offset into mask bitmap

yMask

Vertical pixel offset into mask bitmap

iUsageMask

Value of the bmiColors member of the mask BITMAPINFO structure.

offBmiMask

Offset to mask BITMAPINFO structure.

cbBmiMask

Size of mask BITMAPINFO structure.

offBitsMask

Offset to mask bitmap bits.

cbBitsMask

Size of mask bitmap bits.

See Also

BITMAPINFO, MaskBlt , RGB


 EMRMODIFYWORLDTRANSFORM

The EMRMODIFYWORLDTRANSFORM structure contains members for the ModifyWorldTransform enhanced metafile record.

typedef struct tagEMRMODIFYWORLDTRANSFORM
{
EMR emr;

XFORM xform;

DWORD iMode;

transformation
} EMRMODIFYWORLDTRANSFORM,
PEMRMODIFYWORLDTRANSFORM;

Members

emr

Base structure for all record types.

xform

World-space to page-space transformation data.

iMode

Value specifying how the transformation data modifies the current world transformation. This member can be one of the following values: MWT_IDENTITY, MWT_LEFTMULTIPLY, or MWT_RIGHTMULTIPLY.

See Also

ModifyWorldTransform


 EMROFFSETCLIPRGN

The EMROFFSETCLIPRGN structure contains members for the OffsetClipRgn enhanced metafile record.

typedef struct tagEMROFFSETCLIPRGN
{
EMR emr;

POINTL ptlOffset;

} EMROFFSETCLIPRGN, *PEMROFFSETCLIPRGN;

Members

emr

Base structure for all record types.

ptlOffset

Logical coordinates of offset.

See Also

OffsetClipRgn


 EMRPLGBLT

The EMRPLGBLT structure contains members for the PlgBlt enhanced metafile record. Note that graphics device interface (GDI) converts the device-dependent bitmap into a device-independent bitmap (DIB) before storing it in the metafile record.

typedef struct tagEMRPLGBLT
{
EMR emr;

RECTL rclBounds;

POINTL aptlDest[3];

LONG xSrc;

LONG ySrc;

LONG cxSrc;

LONG cySrc;

XFORM xformSrc;

COLORREF crBkColorSrc;

DWORD iUsageSrc;

DWORD offBmiSrc;

DWORD cbBmiSrc;

DWORD offBitsSrc;

DWORD cbBitsSrc;

LONG xMask;
LONG yMask;

DWORD iUsageMask;

DWORD offBmiMask;

DWORD cbBmiMask;
DWORD offBitsMask;
DWORD cbBitsMask;
} EMRPLGBLT, *PEMRPLGBLT;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

aptlDest

Array of three points in logical space that identify three corners of the destination parallelogram. The upper-left corner of the source rectangle is mapped to the first point in this array, the upper-right corner to the second point in this array, and the lower-left corner to the third point. The lower-right corner of the source rectangle is mapped to the implicit fourth point in the parallelogram.

xSrc

Logical x-coordinate of the upper-left corner of the source rectangle.

ySrc

Logical y-coordinate of the upper-left corner of the source rectangle.

cxSrc

Logical width of source

cySrc

Logical height of source

xformSrc

World-space to page-space transformation of the source device context.

crBkColorSrc

Background color (the RGB value) of the source device context.

iUsageSrc

Value of the bmiColors member of the BITMAPINFO structure. The iUsageSrc member can be either the DIB_PAL_COLORS, DIB_PAL_INDICES, or DIB_RGB_COLORS value.

offBmiSrc

Offset to source BITMAPINFO structure.

cbBmiSrc

Size of source BITMAPINFO structure.

offBitsSrc

Offset to source bitmap bits.

cbBitsSrc

Size of source bitmap bits.

xMask

Horizontal pixel offset into mask bitmap.

yMask

Vertical pixel offset into mask bitmap.

iUsageMask

Value of the bmiColors member of the mask BITMAPINFO structure.

offBmiMask

Offset to mask BITMAPINFO structure.

cbBmiMask

Size of mask BITMAPINFO structure.

offBitsMask

Offset to mask bitmap bits.

cbBitsMask

Size of mask bitmap bits.

See Also

BITMAPINFO, PlgBlt , RGB


 EMRPOLYDRAW

The EMRPOLYDRAW structure contains members for the PolyDraw enhanced metafile record.

typedef struct tagEMRPOLYDRAW
{
EMR emr;

RECTL rclBounds;

DWORD cptl;

POINTL aptl[1];

BYTE abTypes[1];

} EMRPOLYDRAW, *PEMRPOLYDRAW;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

cptl

Number of points.

aptl

Array of 32-bit points.

abTypes

Array of values that specifies how each point in the aptl array is used. This member can be one of the following values: PT_MOVETO, PT_LINETO, or PT_BEZIERTO. The PT_LINETO or PT_BEZIERTO value can be combined with the PT_CLOSEFIGURE value by using the bitwise-xOR operator.

See Also

PolyDraw


 EMRPOLYDRAW16

The EMRPOLYDRAW16 structure contains members for the PolyDraw enhanced metafile record.

typedef struct tagEMRPOLYDRAW16
{
EMR emr;

RECTL rclBounds;

DWORD cpts;

POINTS apts[1];

BYTE abTypes[1];

} EMRPOLYDRAW16, *PEMRPOLYDRAW16;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

cpts

Number of points.

apts

Array of 16-bit points.

abTypes

Array of values that specifies how each point in the apts array is used. This member can be one of the following values: PT_MOVETO, PT_LINETO, or PT_BEZIERTO. The PT_LINETO or PT_BEZIERTO value can be combined with the PT_CLOSEFIGURE value by using the bitwise-OR operator.

See Also

PolyDraw


 EMRPOLYLINE, EMRPOLYBEZIER, EMRPOLYGON, EMRPOLYBEZIERTO, EMRPOLYLINETO

The EMRPOLYLINE, EMRPOLYBEZIER, EMRPOLYGON, EMRPOLYBEZIERTO, and EMRPOLYLINETO structures contain members for the Polyline , PolyBezier , Polygon , PolyBezierTo , and PolylineTo enhanced metafile records.

typedef struct tagEMRPOLYLINE
{
EMR emr;
RECTL rclBounds;

DWORD cptl;

POINTL aptl[1];

} EMRPOLYLINE, *PEMRPOLYLINE,
EMRPOLYBEZIER, *PEMRPOLYBEZIER,
EMRPOLYGON, *PEMRPOLYGON,
EMRPOLYBEZIERTO, *PEMRPOLYBEZIERTO,
EMRPOLYLINETO, *PEMRPOLYLINETO;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

cptl

Number of points array.

aptl

Array of 32-bit points.

See Also

PolyBezier, PolyBezierTo , Polygon , Polyline , PolylineTo


 EMRPOLYLINE16, EMRPOLYBEZIER16, EMRPOLYGON16, EMRPOLYBEZIERTO16, EMRPOLYLINETO16

The EMRPOLYLINE16, EMRPOLYBEZIER16, EMRPOLYGON16, EMRPOLYBEZIERTO16, and EMRPOLYLINETO16 structures contain members for the Polyline , PolyBezier , Polygon , PolyBezierTo , and PolylineTo enhanced metafile records.

typedef struct tagEMRPOLYLINE
{
EMR emr;

RECTL rclBounds;

DWORD cpts;

POINTL apts[1];

} EMRPOLYLINE16, *PEMRPOLYLINE16,
EMRPOLYBEZIER16, *PEMRPOLYBEZIER16,
EMRPOLYGON16, *PEMRPOLYGON16,
EMRPOLYBEZIERTO16, *PEMRPOLYBEZIERTO16,
EMRPOLYLINETO16, *PEMRPOLYLINETO16;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

cpts

Number of points in the array.

apts

Array of 16-bit points.

See Also

PolyBezier, PolyBezierTo , Polygon , Polyline , PolylineTo


 EMRPOLYPOLYLINE, EMRPOLYPOLYGON

The EMRPOLYPOLYLINE and EMRPOLYPOLYGON structures contain members for the PolyPolyline and PolyPolygon enhanced metafile records.

typedef struct tagEMRPOLYPOLYLINE
{
EMR emr;

RECTL rclBounds;

DWORD nPolys;

DWORD cptl;

DWORD aPolyCounts[1];

POINTL aptl[1];

} EMRPOLYPOLYLINE, *PEMRPOLYPOLYLINE,
EMRPOLYPOLYGON, *PEMRPOLYPOLYGON;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

nPolys

Number of polys.

cpt1

Total number of points in all polys.

aPolyCounts

Array of point counts for each poly.

aptl

Array of 32-bit points.

See Also

PolyPolyline, PolyPolygon


 EMRPOLYPOLYLINE16, EMRPOLYPOLYGON16

The EMRPOLYPOLYLINE16 and EMRPOLYPOLYGON16 structures contain members for the PolyPolyline and PolyPolygon enhanced metafile records.

typedef struct tagEMRPOLYPOLYLINE16
{
EMR emr;

RECTL rclBounds;
DWORD nPolys;

DWORD cpts;

DWORD aPolyCounts[1];

POINTS apts[1];

} EMRPOLYPOLYLINE16, *PEMRPOLYPOLYLINE16,
EMRPOLYPOLYGON16, *PEMRPOLYPOLYGON16;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

nPolys

Number of polys.

cpt1

Total number of points in all polys.

aPolyCounts

Array of point counts for each poly.

aptl

Array of 16-bit points.

See Also

PolyPolyline, PolyPolygon


 EMRPOLYTEXTOUTA, EMRPOLYTEXTOUTW

The EMRPOLYTEXTOUTA and EMRPOLYTEXTOUTW structures contain members for the PolyTextOut enhanced metafile record.

typedef struct tagEMRPOLYTEXTOUTA
{
EMR emr;

RECTL rclBounds;

DWORD iGraphicsMode;

FLOAT exScale;

FLOAT eyScale;

LONG cStrings;

EMRTEXT aemrtext[1];

} EMRPOLYTEXTOUTA, *PEMRPOLYTEXTOUTA,
EMRPOLYTEXTOUTW, *PEMRPOLYTEXTOUTW;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

iGraphicsMode

Current graphics mode. This member can be either the GM_COMPATIBLE or GM_ADVANCED value.

exScale

X-scaling factor from page units to .01mm units if the graphics mode is the GM_COMPATIBLE value.

eyScale

Y-scaling factor from page units to .01mm units if the graphics mode is the GM_COMPATIBLE value.

cStrings

Number of strings.

aemrtext

EMRTEXT structure, which is followed by the string and the intercharacter spacing array.

See Also

EMRTEXT


 EMRRESIZEPALETTE

The EMRRESIZEPALETTE structure contains members for the ResizePalette enhanced metafile record.

typedef struct tagEMRRESIZEPALETTE
{
EMR emr;

DWORD ihPal;

DWORD cEntries;

} EMRRESIZEPALETTE, *PEMRRESIZEPALETTE;

Members

emr

Base structure for all record types.

ihPal

Index of palette in handle table.

cEntries

Number of entries in palette after resizing.

See Also

ResizePalette


 EMRRESTOREDC

The EMRRESTOREDC structure contains members for the RestoreDC enhanced metafile record.

typedef struct tagEMRRESTOREDC
{
EMR emr;

LONG iRelative;

} EMRRESTOREDC, *PEMRRESTOREDC;

Members

emr

Base structure for all record types.

iRelative

Relative instance to restore.

See Also

RestoreDC


 EMRROUNDRECT

The EMRROUNDRECT structure contains members for the RoundRect enhanced metafile record.

typedef struct tagEMRROUNDRECT
{
EMR emr;

RECTL rclBox;

SIZEL szlCorner;

} EMRROUNDRECT, *PEMRROUNDRECT;

Members

emr

Base structure for all record types.

szlCorner

Width and height of the ellipse used to draw rounded corners.

See Also

RoundRect


 EMRSCALEVIEWPORTEXTEX, EMRSCALEWINDOWEXTEX

The EMRSCALEVIEWPORTEXTEX and EMRSCALEWINDOWEXTEX structures contain members for the ScaleViewportExtEx and ScaleWindowExtEx enhanced metafile records.

typedef struct tagEMRSCALEVIEWPORTEXTEX
{
EMR emr;

LONG xNum;

LONG xDenom;

LONG yNum;

LONG yDenom;

} EMRSCALEVIEWPORTEXTEX, *PEMRSCALEVIEWPORTEXTEX,

EMRSCALEWINDOWEXTEX, *PEMRSCALEWINDOWEXTEX;

Members

emr

Base structure for all record types.

xNum

Horizontal multiplicand.

xDenom

Horizontal divisor.

yNum

Vertical multiplicand.

yDenom

Vertical divisor.

See Also

ScaleViewportExtEx, ScaleWindowExtEx


 EMRSELECTCOLORSPACE, EMRDELETECOLORSPACE

The EMRSELECTCOLORSPACE and EMRDELETECOLORSPACE structures contain members for the SelectColorSpace and DeleteColorSpace enhanced metafile records.

typedef struct tagEMRSELECTCOLORSPACE

{

EMR emr;

DWORD ihCS;

} EMRSELECTCOLORSPACE, *PEMRSELECTCOLORSPACE,
EMRDELETECOLORSPACE, *PEMRDELETECOLORSPACE;

Members

emr

Base structure for all record types.

ihCS

Color space handle index.

See Also

DeleteColorSpace


 EMRSELECTOBJECT, EMRDELETEOBJECT

The EMRSELECTOBJECT and EMRDELETEOBJECT structures contain members for the SelectObject and DeleteObject enhanced metafile records.

typedef struct tagEMRSELECTOBJECT
{
EMR emr;

DWORD ihObject;
} EMRSELECTOBJECT, *PEMRSELECTOBJECT,
EMRDELETEOBJECT, *PEMRDELETEOBJECT;

Members

emr

Base structure for all record types.

ihObject

Index of object in handle table.

See Also

SelectObject, DeleteObject


 EMRSELECTPALETTE

The EMRSELECTPALETTE structure contains members for the SelectPalette enhanced metafile record. Note that the bForceBackground parameter in SelectPalette is always recorded as TRUE, which causes the palette to be realized as a background palette.

typedef struct tagEMRSELECTPALETTE

{
EMR emr;

DWORD ihPal;

} EMRSELECTPALETTE, *PEMRSELECTPALETTE;

Members

emr

Base structure for all record types.

ihPal

Index to logical palette in handle table.

See Also

SelectPalette


 EMRSETARCDIRECTION

The EMRSETARCDIRECTION structure contains members for the SetArcDirection enhanced metafile record.

typedef struct tagEMRSETARCDIRECTION
{
EMR emr;

DWORD iArcDirection;
} EMRSETARCDIRECTION, *PEMRSETARCDIRECTION;

Members

emr

Base structure for all record types.

iArcDirection

Arc direction. This member can be either the AD_CLOCKWISE or AD_COUNTERCLOCKWISE value.

See Also

Arc, SetArcDirection


 EMRSETBKCOLOR, EMRSETTEXTCOLOR

The EMRSETBKCOLOR and EMRSETTEXTCOLOR structures contain members for the SetBkColor and SetTextColor enhanced metafile records.

typedef struct tagEMRSETTEXTCOLOR
{
EMR emr;

COLORREF crColor;

} EMRSETBKCOLOR, *PEMRSETBKCOLOR,
EMRSETTEXTCOLOR, *PEMRSETTEXTCOLOR;

Members

emr

Base structure for all record types.

crColor

Color value.

See Also

SetBkColor, SetTextColor


 EMRSETCOLORADJUSTMENT

The EMRSETCOLORADJUSTMENT structure contains members for the SetColorAdjustment enhanced metafile record.

typedef struct tagEMRSETCOLORADJUSTMENT
{
EMR emr;

COLORADJUSTMENT ColorAdjustment;

} EMRSETCOLORADJUSTMENT, *PEMRSETCOLORADJUSTMENT;

Members

emr

Base structure for all record types.

ColorAdjustment

COLORADJUSTMENT structure.

See Also

SetColorAdjustment


 EMRSETDIBITSTODEVICE

The EMRSETDIBITSTODEVICE structure contains members for the SetDIBitsToDevice enhanced metafile record.

typedef struct tagEMRSETDIBITSTODEVICE
{
EMR emr;

RECTL rclBounds;

LONG xDest;

LONG yDest;

LONG xSrc;

LONG ySrc;

LONG cxSrc;

LONG cySrc;

DWORD offBmiSrc;

DWORD cbBmiSrc;

DWORD offBitsSrc;

DWORD cbBitsSrc;

DWORD iUsageSrc;

DWORD iStartScan;

DWORD cScans;

} EMRSETDIBITSTODEVICE, *PEMRSETDIBITSTODEVICE;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

xDest

Logical x-coordinate of the upper-left corner of the destination rectangle.

yDest

Logical y-coordinate of the upper-left corner of the destination rectangle.

xSrc

Logical x-coordinate of the lower-left corner of the source device-independent bitmap (DIB).

ySrc

Logical y-coordinate of the lower-left corner of the source DIB.

cxSrc

Width of source rectangle.

cyScr

Height of source rectangle.

offBmiSrc

Offset to source BITMAPINFO structure.

cbBmiSrc

Size of source BITMAPINFO structure.

offBitsSrc

Offset to source bitmap bits.

cbBitsSrc

Size of source bitmap bits.

iUsageSrc

Value of the bmiColors member of the BITMAPINFO structure. The iUsageSrc member can be either the DIB_PAL_COLORS, DIB_PAL_INDICES, or DIB_RGB_COLORS value.

iStartScan

First scan line in array.

cScans

Number of scan lines.

See Also

BITMAPINFO, SetDIBitsToDevice


 EMRSETMAPPERFLAGS

The EMRSETMAPPERFLAGS structure contains members for the SetMapperFlags enhanced metafile record.

typedef struct tagEMRSETMAPPERFLAGS
{
EMR emr;

DWORD dwFlags;

} EMRSETMAPPERFLAGS, *PEMRSETMAPPERFLAGS;

Members

emr

Base structure for all record types.

dwFlags

Font mapper flag.

See Also

SetMapperFlags


 EMRSETMITERLIMIT

The EMRSETMITERLIMIT structure contains members for the SetMiterLimit enhanced metafile record.

typedef struct tagEMRSETMITERLIMIT
{
EMR emr;
FLOAT eMiterLimit;

} EMRSETMITERLIMIT, *PEMRSETMITERLIMIT;

Members

emr

Base structure for all record types.

eMiterLimit

New miter limit.

See Also

SetMiterLimit


 EMRSETPALETTEENTRIES

The EMRSETPALETTEENTRIES structure contains members for the SetPaletteEntries enhanced metafile record.

typedef struct tagEMRSETPALETTEENTRIES
{
EMR emr;

DWORD ihPal;

DWORD iStart;

DWORD cEntries;

PALETTEENTRY aPalEntries[1];

} EMRSETPALETTEENTRIES, *PEMRSETPALETTEENTRIES;

Members

emr

Base structure for all record types.

ihPal

Palette handle index.

iStart

Index of first entry to set.

cEntries

Number of entries.

aPalEntries

Array of PALETTEENTRY structures. Note that peFlags members in the structures do not contain any flags.

See Also

PALETTEENTRY, SetPaletteEntries


 EMRSETPIXELV

The EMRSETPIXELV structure contains members for the SetPixelV enhanced metafile record. When an enhanced metafile is created, calls to SetPixel are also recorded in this record.

typedef struct tagEMRSETPIXELV
{
EMR emr;

POINTL ptlPixel;

COLORREF crColor;

} EMRSETPIXELV, *PEMRSETPIXELV;

Members

emr

Base structure for all record types.

ptlPixel

Logical coordinates of pixel.

crColor

Color value.

See Also

SetPixelV, SetPixel


 EMRSETVIEWPORTEXTEX, EMRSETWINDOWEXTEX

The EMRSETVIEWPORTEXTEX and EMRSETWINDOWEXTEX structures contains members for the SetViewportExtEx and SetWindowExtEx enhanced metafile records.

typedef struct tagEMRSETVIEWPORTEXTEX
{
EMR emr;

SIZEL szlExtent;

} EMRSETVIEWPORTEXTEX, *PEMRSETVIEWPORTEXTEX,
EMRSETWINDOWEXTEX, *PEMRSETWINDOWEXTEX;

Members

emr

Base structure for all record types.

szlExtent

Horizontal and vertical extents. For SetViewportExtEx, the extents are in device units, and for SetWindowExtEx, the extents are in logical units.

See Also

SetViewportExtEx, SetWindowExtEx


 EMRSETVIEWPORTORGEX, EMRSETWINDOWORGEX, EMRSETBRUSHORGEX

The EMRSETVIEWPORTORGEX, EMRSETWINDOWORGEX, and EMRSETBRUSHORGEX structures contain members for the SetViewportOrgEx, SetWindowOrgEx, and SetBrushOrgEx enhanced metafile records.

typedef struct tagEMRSETVIEWPORTORGEX
{
EMR emr;

POINTL ptlOrigin;

} EMRSETVIEWPORTORGEX, *PEMRSETVIEWPORTORGEX,
EMRSETWINDOWORGEX, *PEMRSETWINDOWORGEX,
EMRSETBRUSHORGEX, *PEMRSETBRUSHORGEX;

Members

emr

Base structure for all record types.

ptlOrigin

Coordinate of origin.

See Also

SetBrushOrgEx, SetViewportOrgEx , SetWindowOrgEx


 EMRSETWORLDTRANSFORM

The EMRSETWORLDTRANSFORM structure contains members for the SetWorldTransform enhanced metafile record.

typedef struct tagEMRSETWORLDTRANSFORM
{
EMR emr;

XFORM xform;

} EMRSETWORLDTRANSFORM, *PEMRSETWORLDTRANSFORM;

Members

emr

Base structure for all record types.

xform

World-space to page-space transformation data.

See Also

SetWorldTransform


 EMRSTRETCHBLT

The EMRSTRETCHBLT structure contains members for the StretchBlt enhanced metafile record. Note that graphics device interface (GDI) converts the device-dependent bitmap into a device-independent bitmap (DIB) before storing it in the metafile record.

typedef struct tagEMRSTRETCHBLT
{
EMR emr;

RECTL rclBounds;

LONG xDest;

LONG yDest;

LONG cxDest;

LONG cyDest;

DWORD dwRop;

LONG xSrc;

LONG ySrc;

XFORM xformSrc;

COLORREF crBkColorSrc;

DWORD iUsageSrc;

DWORD offBmiSrc;

DWORD cbBmiSrc;

DWORD offBitsSrc;

DWORD cbBitsSrc;

LONG cxSrc;

LONG cySrc;

} EMRSTRETCHBLT, *PEMRSTRETCHBLT;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

xDest

Logical x-coordinate of the upper-left corner of the destination rectangle.

yDest

Logical y-coordinate of the upper-left corner of the destination rectangle.

cxDest

Logical width of destination rectangle

cyDest

Logical height of destination rectangle

dwRop

Raster-operation code. These codes define how the color data of the source rectangle is to be combined with the color data of the destination rectangle to achieve the final color.

xSrc

Logical x-coordinate of the upper-left corner of the source rectangle.

ySrc

Logical y-coordinate of the upper-left corner of the source rectangle.

xformSrc

World-space to page-space transformation of the source device context.

crBkColorSrc

Background color (the RGB value) of the source device context.

iUsageSrc

Value of the bmiColors member of the BITMAPINFO structure. The iUsageSrc member can be either the DIB_PAL_COLORS, DIB_PAL_INDICES, or DIB_RGB_COLORS value.

offBmiSrc

Offset to source BITMAPINFO structure.

cbBmiSrc

Size of source BITMAPINFO structure.

offBitsSrc

Offset to source bitmap bits.

cbBitsSrc

Size of source bitmap bits.

cxSrc

Width of source rectangle.

cySrc

Height of source rectangle.

See Also

BITMAPINFO, RGB, StretchBlt


 EMRSTRETCHDIBITS

The EMRSTRETCHDIBITS structure contains members for the StretchDIBits enhanced metafile record.

typedef struct tagEMRSTRETCHDIBITS
{
EMR emr;
RECTL rclBounds;

LONG xDest;

LONG yDest;

LONG xSrc;

LONG ySrc;

LONG cxSrc;

LONG cySrc;
DWORD offBmiSrc;
DWORD cbBmiSrc;

DWORD offBitsSrc;

DWORD cbBitsSrc;

DWORD iUsageSrc;

DWORD dwRop;

LONG cxDest;

LONG cyDest;

} EMRSTRETCHDIBITS, *PEMRSTRETCHDIBITS;

Members

emr

Base structure for all record types.

rclBounds

Bounding rectangle, in device units.

xDest

Logical x-coordinate of the upper-left corner of the destination rectangle.

yDest

Logical y-coordinate of the upper-left corner of the destination rectangle.

xSrc

Logical x-coordinate of the upper-left corner of the source rectangle.

ySrc

Logical y-coordinate of the upper-left corner of the source rectangle.

cxSrc

Width of source rectangle.

cyScr

Height of source rectangle.

offBmiSrc

Offset to source BITMAPINFO structure.

cbBmiSrc

Size of source BITMAPINFO structure.

offBitsSrc

Offset to source bitmap bits.

cbBitsSrc

Size of source bitmap bits.

iUsageSrc

Value of the bmiColors member of the BITMAPINFO structure. The iUsageSrc member can be either the DIB_PAL_COLORS, DIB_PAL_INDICES, or DIB_RGB_COLORS value.

dwRop

Raster-operation code. These codes define how the color data of the source rectangle is to be combined with the color data of the destination rectangle to achieve the final color.

cxDest

Logical width of destination rectangle

cyDest

Logical height of destination rectangle

See Also

BITMAPINFO, StretchDIBits


 EMRTEXT

The EMRTEXT structure contains members for text output.

typedef struct tagEMRTEXT

{
POINTL ptlReference;

DWORD nChars;

DWORD offString;

DWORD fOptions;

RECTL rcl;

DWORD offDx;

} EMRTEXT, *PEMRTEXT;

Members

ptlReference

Logical coordinates of the reference point used to position the string.

nChars

Number of characters in string.

offString

Offset to string.

fOptions

Value specifying how to use the application-defined rectangle. This member can be a combination of the ETO_CLIPPED and ETO_OPAQUE values.

rcl

Optional clipping and/or opaquing rectangle.

offDx

Offset to intercharacter spacing array.

Remarks

The EMRTEXT structure is used as a member in the EMREXTTEXTOUT and EMRPOLYTEXTOUT structures.


 LB_ADDFILE

An application sends an LB_ADDFILE message to add the specified filename to a list box that contains a directory listing.

LB_ADDFILE

wParam = 0; // not used; must be zero

lParam = (LPARAM) (LPCTSTR) lpszFilename; // name of file to add

Parameters

lpszFilename

Value of lParam. Points to the name of the file to add.

Return Values

The return value is the zero-based index of the file that was added, or LB_ERR if an error occurs.

Remarks

The list box to which lpszFilename is added must have been filled by the DlgDirList function.

See Also

DlgDirList, LB_ADDSTRING


 LB_ADDSTRING

An application sends an LB_ADDSTRING message to add a string to a list box. If the list box does not have the LBS_SORT style, the string is added to the end of the list. Otherwise, the string is inserted into the list and the list is sorted.

LB_ADDSTRING

wParam = 0; // not used; must be zero

lParam = (LPARAM) (LPCTSTR) lpsz; // address of string to add

Parameters

lpsz

Value of lParam. Points to the null-terminated string that is to be added.

If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, the value of the lpsz parameter is stored as item data instead of the string it would otherwise point to. You can send the LB_GETITEMDATA and LB_SETITEMDATA messages to retrieve or modify the item data.

Return Values

The return value is the zero-based index of the string in the list box. If an error occurs, the return value is LB_ERR. If there is insufficient space to store the new string, the return value is LB_ERRSPACE.

Remarks

If you create an owner-drawn list box with the LBS_SORT style but not the LBS_HASSTRINGS style, the system sends the WM_COMPAREITEM message one or more times to the owner of the list box to place the new item properly in the list box.

See Also

LB_DELETESTRING, LB_INSERTSTRING, LB_SELECTSTRING, WM_COMPAREITEM


 LB_DELETESTRING

An application sends an LB_DELETESTRING message to delete a string in a list box.

LB_DELETESTRING

wParam = (WPARAM) index; // index of string to delete

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the string to be deleted.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

The return value is a count of the strings remaining in the list. The return value is LB_ERR if the index parameter specifies an index greater than the number of items in the list.

Remarks

If an application creates the list box with an owner-drawn style but without the LBS_HASSTRINGS style, the system sends a WM_DELETEITEM message to the owner of the list box so the application can free any additional data associated with the item.

See Also

LB_ADDSTRING, LB_INSERTSTRING, WM_DELETEITEM


 LB_DIR

An application sends an LB_DIR message to add a list of filenames to a list box.

LB_DIR

wParam = (WPARAM) (UINT) uAttrs; // file attributes

lParam = (LPARAM) (LPCTSTR) lpszFileSpec; // filename address

Parameters

uAttrs

Value of wParam. Specifies the attributes of the files to be added to the list box. This parameter can be a combination of the following values:

Value | Description
DDL_ARCHIVE | Includes archived files.
DDL_DIRECTORY | Includes subdirectories. Subdirectory names are enclosed in square brackets ([ ]).
DDL_DRIVES | Includes drives. Drives are listed in the form [-x-], where x is the drive letter.
DDL_EXCLUSIVE | Includes only files with the specified attributes. By default, read-write files are listed even if DDL_READWRITE is not specified.
DDL_HIDDEN | Includes hidden files.
DDL_READONLY | Includes read-only files.
DDL_READWRITE | Includes read-write files with no additional attributes.
DDL_SYSTEM | Includes system files.

lpszFileSpec

Value of lParam. Points to the null-terminated string that specifies the filename to add to the list. If the filename contains wildcards (for example, *.*), all files that match the wildcards and have the attributes specified by the uAttrs parameter are added to the list.

Return Values

The return value is the zero-based index of the last filename added to the list. If an error occurs, the return value is LB_ERR. If there is insufficient space to store the new strings, the return value is LB_ERRSPACE.

See Also

DlgDirList


 LB_FINDSTRING

An application sends an LB_FINDSTRING message to find the first string in a list box that contains the specified prefix.

LB_FINDSTRING

wParam = (WPARAM) indexStart; // item before start of search

lParam = (LPARAM) (LPCTSTR) lpszFind; // search string address

Parameters

indexStart

Value of wParam. Specifies the zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by the indexStart parameter. If indexStart is [image] 1, the entire list box is searched from the beginning.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

lpszFind

Value of lParam. Points to the null-terminated string that contains the prefix to search for. The search is case independent, so this string can contain any combination of uppercase and lowercase letters.

Return Values

The return value is the index of the matching item, or LB_ERR if the search was unsuccessful.

Remarks

If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, this message returns the index of the item with a long value (supplied as the lParam parameter of the LB_ADDSTRING or LB_INSERTSTRING message) that matches the value supplied as the lpszFind parameter.

See Also

LB_ADDSTRING, LB_INSERTSTRING, LB_SELECTSTRING


 LB_FINDSTRINGEXACT

An application sends a LB_FINDSTRINGEXACT message to find the first list box string that matches the string specified in the lpszFind parameter.

LB_FINDSTRINGEXACT

wParam = (WPARAM) indexStart; // item before start of search

lParam = (LPARAM)(LPCSTR)lpszFind; // address of search string

Parameters

indexStart

Value of wParam. Specifies the zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by the indexStart parameter. If indexStart is [image] 1, the entire list box is searched from the beginning.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

lpszFind

Value of lParam. Points to the null-terminated string to search for. This string can contain a complete filename, including the extension. The search is not case sensitive, so this string can contain any combination of uppercase and lowercase letters.

Return Values

The return value is the zero-based index of the matching item, or LB_ERR if the search was unsuccessful.

Remarks

If an application creates the list box with an owner-drawn style but without the LBS_HASSTRINGS style, the action taken by LB_FINDSTRINGEXACT depends on whether the LBS_SORT style is used. If LBS_SORT is used, the system sends WM_COMPAREITEM messages to the list box owner to determine which item matches the specified string. Otherwise, LB_FINDSTRINGEXACT attempts to match the 32-bit value against the value of the lpszFind parameter.

See Also

LB_FINDSTRING, LB_SELECTSTRING, WM_COMPAREITEM


 LB_GETANCHORINDEX

An application sends an LB_GETANCHORINDEX message to retrieve the index of the anchor item [image] that is, the item from which a multiple selection starts. A multiple selection spans all items from the anchor item to the caret item.

LB_GETANCHORINDEX

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the index of the anchor item.

See Also

LB_SETANCHORINDEX


 LB_GETCARETINDEX

An application sends an LB_GETCARETINDEX message to determine the index of the item that has the focus rectangle in a multiple-selection list box. The item may or may not be selected.

LB_GETCARETINDEX

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the zero-based index of the list box item that has the focus rectangle. If the list box is a single-selection list box, the return value is the zero-based index of the item that is selected, if any.

See Also

LB_SETCARETINDEX


 LB_GETCOUNT

An application sends an LB_GETCOUNT message to retrieve the number of items in a list box.

LB_GETCOUNT

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the number of items in the list box, or LB_ERR if an error occurs.

Remarks

The returned count is one greater than the index value of the last item (the index is zero-based).

See Also

LB_SETCOUNT


 LB_GETCURSEL

Send an LB_GETCURSEL message to retrieve the index of the currently selected item, if any, in a single-selection list box.

LB_GETCURSEL

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

In a single-selection list box, the return value is the zero-based index of the currently selected item. If there is no selection, the return value is LB_ERR.

Remarks

Do not send this message to a multiple-selection list box.

To retrieve the indexes of the selected items in a multiple-selection list box, use the LB_GETSELITEMS message. To determine whether the item that has the focus rectangle in a multiple selection list box is selected, use the LB_GETSEL message.

If sent to a multiple-selection list box, LB_GETCURSEL returns the index of the item that has the focus rectangle. If no items are selected, it returns zero.

See Also

LB_GETCARETINDEX, LB_GETSEL, LB_GETSELITEMS, LB_SETCURSEL


 LB_GETHORIZONTALEXTENT

An application sends an LB_GETHORIZONTALEXTENT message to retrieve from a list box the width, in pixels, by which the list box can be scrolled horizontally (the scrollable width) if the list box has a horizontal scroll bar.

LB_GETHORIZONTALEXTENT

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the scrollable width, in pixels, of the list box.

Remarks

To respond to the LB_GETHORIZONTALEXTENT message, the list box must have been defined with the WS_HSCROLL style.

See Also

LB_SETHORIZONTALEXTENT


 LB_GETITEMDATA

An application sends an LB_GETITEMDATA message to retrieve the application-defined 32-bit value associated with the specified list box item.

LB_GETITEMDATA

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the index of the item.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

The return value is the 32-bit value associated with the item, or LB_ERR if an error occurs. If the item is in an owner-drawn list box and was created without the LBS_HASSTRINGS style, this 32-bit value was in the lParam parameter of the LB_ADDSTRING or LB_INSERTSTRING message that added the item to the list box. Otherwise, it is the value in the lParam of an LB_SETITEMDATA message.

See Also

LB_ADDSTRING, LB_INSERTSTRING, LB_SETITEMDATA


 LB_GETITEMHEIGHT

An application sends an LB_GETITEMHEIGHT message to retrieve the height of items in a list box.

LB_GETITEMHEIGHT

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the list box item. This index is used only if the list box has the LBS_OWNERDRAWVARIABLE style; otherwise, it must be zero.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

The return value is the height, in pixels, of each item in the list box. The return value is the height of the item specified by the index parameter if the list box has the LBS_OWNERDRAWVARIABLE style. The return value is LB_ERR if an error occurs.

See Also

LB_SETITEMHEIGHT


 LB_GETITEMRECT

An application sends an LB_GETITEMRECT message to retrieve the dimensions of the rectangle that bounds a list box item as it is currently displayed in the list box.

LB_GETITEMRECT

wParam = (WPARAM) index; // item index

lParam = (LPARAM) (RECT FAR*) lprc; // address of rectangle

Parameters

index

Value of wParam. Specifies the zero-based index of the item.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

lprc

Value of lParam. Points to a RECT structure that will receive the client coordinates for the item in the list box.

Return Values

If an error occurs, the return value is LB_ERR.

See Also

RECT


 LB_GETLOCALE

An application sends an LB_GETLOCALE message to retrieve the current locale of the list box. You can use the locale to determine the correct sorting order of displayed text (for list boxes with the LBS_SORT style) and of text added by the LB_ADDSTRING message.

LB_GETLOCALE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is a 32-bit value that specifies the current locale of the list box. The high-order word contains the country code and the low-order word contains the language identifier.

Remarks

The language identifier consists of a sublanguage identifier and a primary language identifier. Use the PRIMARYLANGID macro to extract the primary language identifier from the low-order word of the return value, and the SUBLANGID macro to extract the sublanguage identifier.

See Also

LB_ADDSTRING, LB_SETLOCALE, PRIMARYLANGID , SUBLANGID


 LB_GETSEL

An application sends an LB_GETSEL message to retrieve the selection state of an item.

LB_GETSEL

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the item.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

If an item is selected, the return value is greater than zero; otherwise, it is zero. If an error occurs, the return value is LB_ERR.

See Also

LB_SETSEL


 LB_GETSELCOUNT

An application sends an LB_GETSELCOUNT message to retrieve the total number of selected items in a multiple-selection list box.

LB_GETSELCOUNT

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the count of selected items in the list box. If the list box is a single-selection list box, the return value is LB_ERR.

See Also

LB_SETSEL


 LB_GETSELITEMS

An application sends an LB_GETSELITEMS message to fill a buffer with an array of integers that specify the item numbers of selected items in a multiple-selection list box.

LB_GETSELITEMS

wParam = (WPARAM) cItems; // maximum number of items

lParam = (LPARAM) (LPINT) lpnItems; // address of buffer

Parameters

cItems

Value of wParam. Specifies the maximum number of selected items whose item numbers are to be placed in the buffer.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

lpnItems

Value of lParam. Points to a buffer large enough for the number of integers specified by the cItems parameter.

Return Values

The return value is the number of items placed in the buffer. If the list box is a single-selection list box, the return value is LB_ERR.

See Also

LB_GETSELCOUNT


 LB_GETTEXT

An application sends an LB_GETTEXT message to retrieve a string from a list box.

LB_GETTEXT

wParam = (WPARAM) index; // item index

lParam = (LPARAM) (LPCTSTR) lpszBuffer; // address of buffer

Parameters

index

Value of wParam. Specifies the zero-based index of the string to retrieve.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

lpszBuffer

Value of lParam. Points to the buffer that will receive the string. The buffer must have sufficient space for the string and a terminating null character. An LB_GETTEXTLEN message can be sent before the LB_GETTEXT message to retrieve the length, in characters, of the string.

Return Values

The return value is the length of the string, in characters, excluding the terminating null character. If index does not specify a valid index, the return value is LB_ERR.

Remarks

If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, the buffer pointed to by the lpszBuffer parameter will receive the 32-bit value associated with the item (the item data).

See Also

LB_GETTEXTLEN


 LB_GETTEXTLEN

An application sends an LB_GETTEXTLEN message to retrieve the length of a string in a list box.

LB_GETTEXTLEN

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the string.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

The return value is the length of the string, in characters, excluding the terminating null character. Under certain conditions, this value may actually be greater than the length of the text. For more information, see the following Remarks section.

If the index parameter does not specify a valid index, the return value is LB_ERR.

Remarks

Under certain conditions, the return value is larger than the actual length of the text. This occurs with certain mixtures of ANSI and Unicode, and is due to the operating system allowing for the possible existence of double-byte character set (DBCS) characters within the text. The return value, however, will always be at least as large as the actual length of the text; you can thus always use it to guide buffer allocation. This behavior can occur when an application uses both ANSI functions and common dialogs, which use Unicode.

To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the GetWindowText function.

See Also

CB_GETLBTEXT, GetWindowText , LB_GETTEXT, WM_GETTEXT


 LB_GETTOPINDEX

An application sends an LB_GETTOPINDEX message to retrieve the index of the first visible item in a list box. Initially the item with index 0 is at the top of the list box, but if the list box contents have been scrolled another item may be at the top.

LB_GETTOPINDEX

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the index of the first visible item in the list box.

See Also

LB_SETTOPINDEX


 LB_INITSTORAGE

Allocates memory for storing list box items. An application sends this message before adding a large number of items to a list box.

LB_INITSTORAGE

wParam = (WPARAM) (int) cItems; // number of items to add

lParam = (LPARAM) (DWORD) cb; // amount of memory to allocate, in bytes

Parameters

cItems

Specifies the number of items to add.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

cb

Specifies the amount of memory, in bytes, to allocate for item strings.

Return Values

The return value is the maximum number of items that the memory object can store before another memory reallocation is needed, if successful. It is LB_ERRSPACE if not enough memory is available.

Remarks

Windows 95: This message helps speed up the initialization of list boxes that have a large number of items (more than 100). It reserves the specified amount of memory so that subsequent LB_ADDSTRING, LB_INSERTSTRING, LB_DIR, and LB_ADDFILE messages take the shortest possible time. You can use estimates for the cItems and cb parameters. If you overestimate, the extra memory is allocated; if you underestimate, the normal allocation is used for items that exceed the requested amount.

Windows NT: This message is not needed on Windows NT. It does not reserve the specified amount of memory, because available memory is virtually unlimited. The return value is always the value specified in the cItems parameter.

See Also

LB_ADDFILE, LB_ADDSTRING, LB_DIR, LB_INSERTSTRING


 LB_INSERTSTRING

An application sends an LB_INSERTSTRING message to insert a string into a list box. Unlike the LB_ADDSTRING message, the LB_INSERTSTRING message does not cause a list with the LBS_SORT style to be sorted.

LB_INSERTSTRING

wParam = (WPARAM) index; // item index

lParam = (LPARAM) (LPCTSTR) lpsz; // address of string to insert

Parameters

index

Value of wParam. Specifies the zero-based index of the position at which to insert the string. If this parameter is [image] 1, the string is added to the end of the list.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

lpsz

Value of lParam. Points to the null-terminated string to be inserted.

If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, the value of the lpsz parameter is stored as item data instead of the string it would otherwise point to. You can send the LB_GETITEMDATA and LB_SETITEMDATA messages to retrieve or modify the item data.

Return Values

The return value is the index of the position at which the string was inserted. If an error occurs, the return value is LB_ERR. If there is insufficient space to store the new string, the return value is LB_ERRSPACE.

See Also

LB_ADDSTRING, LB_SELECTSTRING


 LB_ITEMFROMPOINT

An application sends this message to retrieve the zero-based index of the item nearest the specified point in a list box.

LB_ITEMFROMPOINT

wParam = 0; // not used, must be zero

lParam = (LPARAM) MAKELPARAM(xPos, yPos); // coordinates of point

Parameters

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of a point, relative to the upper-left corner of the client area of the list box.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of a point, relative to the upper-left corner of the client area of the list box.

Return Values

The return value contains the index of the nearest item in the low-order word. The high-order word is zero if the specified point is in the client area of the list box, or one if it is outside the client area.


 LB_RESETCONTENT

An application sends an LB_RESETCONTENT to remove all items from a list box.

LB_RESETCONTENT

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, the owner of the list box receives a WM_DELETEITEM message for each item in the list box.

See Also

WM_DELETEITEM


 LB_SELECTSTRING

An application sends an LB_SELECTSTRING message to search a list box for an item that begins with the characters in a specified string. If a matching item is found, the item is selected.

LB_SELECTSTRING

wParam = (WPARAM) indexStart; // item before start of search

lParam = (LPARAM)(LPCTSTR)lpszFind; // address of search string

Parameters

indexStart

Value of wParam. Specifies the zero-based index of the item before the first item to be searched. When the search reaches the bottom of the list box, it continues from the top of the list box back to the item specified by the indexStart parameter. If indexStart is [image] 1, the entire list box is searched from the beginning.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

lpszFind

Value of lParam. Points to the null-terminated string that contains the prefix to search for. The search is case independent, so this string can contain any combination of uppercase and lowercase letters.

Return Values

If the search is successful, the return value is the index of the selected item. If the search is unsuccessful, the return value is LB_ERR and the current selection is not changed.

Remarks

The list box is scrolled, if necessary, to bring the selected item into view.

Do not use this message with a list box that has the LBS_MULTIPLESEL style.

An item is selected only if its initial characters from the starting point match the characters in the string specified by the lpszFind parameter.

If you create the list box with an owner-drawn style but without the LBS_HASSTRINGS style, this message returns the index of the item whose long value (supplied as the lParam parameter of the LB_ADDSTRING or LB_INSERTSTRING message) matches the value supplied as the lParam parameter of LB_SELECTSTRING.

See Also

LB_ADDSTRING, LB_FINDSTRING, LB_INSERTSTRING


 LB_SELITEMRANGE

An application sends an LB_SELITEMRANGE message to select one or more consecutive items in a multiple-selection list box.

LB_SELITEMRANGE

wParam = (WPARAM) (BOOL) fSelect; // selection flag

lParam = MAKELPARAM(wFirst, wLast); // first and last items

Parameters

fSelect

Value of wParam. Specifies how to set the selection. If the fSelect parameter is TRUE, the string is selected and highlighted; if fSelect is zero, the highlight is removed and the string is no longer selected.

wFirst

Value of the low-order word of lParam. Specifies the zero-based index of the first item to select.

wLast

Value of the high-order word of lParam. Specifies the zero-based index of the last item to select.

Return Values

If an error occurs, the return value is LB_ERR.

Remarks

Use this message only with multiple-selection list boxes.

This message can select a range only within the first 65,536 items.

See Also

LB_SELITEMRANGEEX, LB_SETSEL


 LB_SELITEMRANGEEX

An application sends an LB_SELITEMRANGEEX message to select one or more consecutive items in a multiple-selection list box.

LB_SELITEMRANGEEX

wParam = (WPARAM) wFirst; // first item

lParam = (LPARAM) wLast); // last item

Parameters

wFirst

Value of wParam. Specifies the zero-based index of the first item to select.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

wLast

Value of lParam. Specifies the zero-based index of the last item to select.

Return Values

If an error occurs, the return value is LB_ERR.

Remarks

If the wFirst parameter is less than the wLast parameter, the specified range of items is selected. If wFirst is greater than wLast, the selection is removed from the specified range of items.

Use this message only with multiple-selection list boxes.

This message can select a range only within the first 65,536 items.

See Also

LB_SELITEMRANGE, LB_SETSEL


 LB_SETANCHORINDEX

An application sends an LB_SETANCHORINDEX message to set the anchor item [image] that is, the item from which a multiple selection starts. A multiple selection spans all items from the anchor item to the caret item.

LB_SETANCHORINDEX

wParam = (WPARAM) index; // index to set as anchor

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the index of the new anchor item.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

If the message succeeds, the return value is zero.

If the message fails, the return value is LB_ERR.

See Also

LB_GETANCHORINDEX


 LB_SETCARETINDEX

An application sends an LB_SETCARETINDEX message to set the focus rectangle to the item at the specified index in a multiple-selection list box. If the item is not visible, it is scrolled into view.

LB_SETCARETINDEX

wParam = (WPARAM) index; // item index

lParam = MAKELPARAM(fScroll, 0); // flag for scrolling item

Parameters

index

Value of wParam. Specifies the zero-based index of the list box item that is to receive the focus rectangle.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

fScroll

Value of lParam. If this value is FALSE, the item is scrolled until it is fully visible; if it is TRUE, the item is scrolled until it is at least partially visible.

Return Values

If an error occurs, the return value is LB_ERR.

See Also

LB_GETCARETINDEX


 LB_SETCOLUMNWIDTH

An application sends an LB_SETCOLUMNWIDTH message to a multiple-column list box (created with the LBS_MULTICOLUMN style) to set the width, in pixels, of all columns in the list box.

LB_SETCOLUMNWIDTH

wParam = (WPARAM) cxColumn; // column width in pixels

lParam = 0; // not used; must be zero

Parameters

cxColumn

Value of wParam. Specifies the width, in pixels, of all columns.

Return Values

This message does not return a value.

See Also

LB_SETTABSTOPS


 LB_SETCOUNT

An application sends an LB_SETCOUNT message to set the count of items in a list box created with the LBS_NODATA style and not created with the LBS_HASSTRINGS style.

LB_SETCOUNT

wParam = (WPARAM) (int) cItems; // count of list box items

lParam = 0; // not used; must be zero

Parameters

cItems

Value of wParam. Specifies the new count of items in the list box.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

If an error occurs, the return value is LB_ERR. If there is insufficient memory to store the items, the return value is LB_ERRSPACE.

Remarks

The LB_SETCOUNT message is supported only by list boxes created with the LBS_NODATA style and not created with the LBS_HASSTRINGS style. All other list boxes return LB_ERR.

See Also

LB_GETCOUNT


 LB_SETCURSEL

An application sends an LB_SETCURSEL message to select a string and scroll it into view, if necessary. When the new string is selected, the list box removes the highlight from the previously selected string.

LB_SETCURSEL

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the string that is selected. If the index parameter is -1, the list box is set to have no selection.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

If an error occurs, the return value is LB_ERR. If the index parameter is [image] 1, the return value is LB_ERR even though no error occurred.

Remarks

Use this message only with single-selection list boxes. You cannot use it to set or remove a selection in a multiple-selection list box.

See Also

LB_GETCURSEL


 LB_SETHORIZONTALEXTENT

An application sends an LB_SETHORIZONTALEXTENT message to set the width, in pixels, by which a list box can be scrolled horizontally (the scrollable width). If the width of the list box is smaller than this value, the horizontal scroll bar horizontally scrolls items in the list box. If the width of the list box is equal to or greater than this value, the horizontal scroll bar is hidden.

LB_SETHORIZONTALEXTENT

wParam = (WPARAM) cxExtent; // horizontal scroll width

lParam = 0; // not used; must be zero

Parameters

cxExtent

Value of wParam. Specifies the number of pixels by which the list box can be scrolled.

Windows 95: The wParam parameter is limited to 16-bit values.

Return Values

This message does not return a value.

Remarks

To respond to the LB_SETHORIZONTALEXTENT message, the list box must have been defined with the WS_HSCROLL style.

See Also

LB_GETHORIZONTALEXTENT


 LB_SETITEMDATA

An application sends an LB_SETITEMDATA message to set a 32-bit value associated with the specified item in a list box.

LB_SETITEMDATA

wParam = (WPARAM) index; // item index

lParam = (LPARAM) dwData; // value to associate with item

Parameters

index

Value of wParam. Specifies the zero-based index of the item.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

dwData

Value of lParam. Specifies the 32-bit value to be associated with the item.

Return Values

If an error occurs, the return value is LB_ERR.

Remarks

If the item is in an owner-drawn list box created without the LBS_HASSTRINGS style, this message replaces the 32-bit value contained in the lParam parameter of the LB_ADDSTRING or LB_INSERTSTRING message that added the item to the list box.

See Also

LB_ADDSTRING, LB_GETITEMDATA, LB_INSERTSTRING


 LB_SETITEMHEIGHT

An application sends an LB_SETITEMHEIGHT message to set the height, in pixels, of items in a list box. If the list box has the LBS_OWNERDRAWVARIABLE style, this message sets the height of the item specified by the index parameter. Otherwise, this message sets the height of all items in the list box.

LB_SETITEMHEIGHT

wParam = (WPARAM) index; // item index

lParam = MAKELPARAM(cyItem, 0); // item height

Parameters

index

Value of wParam. Specifies the zero-based index of the item in the list box. Use this parameter only if the list box has the LBS_OWNERDRAWVARIABLE style; otherwise, set it to zero.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

cyItem

Value of lParam. Specifies the height, in pixels, of the item.

Return Values

If the index or height is invalid, the return value is LB_ERR.

See Also

LB_GETITEMHEIGHT


 LB_SETLOCALE

An application sends an LB_SETLOCALE message to set the current locale of the list box. You can use the locale to determine the correct sorting order of displayed text (for list boxes with the LBS_SORT style) and of text added by the LB_ADDSTRING message.

LB_SETLOCALE

wParam = (WPARAM) wLocaleID; // locale identifier

lParam = 0; // not used; must be zero

Parameters

wLocaleID

Value of wParam. Specifies the locale identifier that the list box will use for sorting when adding text.

Return Values

The return value is the previous locale identifier. If the wLocaleID parameter specifies a locale that is not installed on the system, the return value is LB_ERR and the current list box locale is not changed.

Remarks

Use the MAKELCID macro to construct a locale identifier.

See Also

LB_ADDSTRING, LB_GETLOCALE, MAKELCID


 LB_SETSEL

An application sends an LB_SETSEL message to select a string in a multiple-selection list box.

LB_SETSEL

wParam = (WPARAM) (BOOL) fSelect; // selection flag

lParam = (LPARAM) (UINT) index; // item index

Parameters

fSelect

Value of wParam. Specifies how to set the selection. If the fSelect parameter is TRUE, the string is selected and highlighted; if fSelect is FALSE, the highlight is removed and the string is no longer selected.

index

Value of lParam. Specifies the zero-based index of the string to set. If index is [image] 1, the selection is added to or removed from all strings, depending on the value of fSelect.

Return Values

If an error occurs, the return value is LB_ERR.

Remarks

Use this message only with multiple-selection list boxes.

See Also

LB_GETSEL, LB_SELITEMRANGE


 LB_SETTABSTOPS

An application sends an LB_SETTABSTOPS message to set the tab-stop positions in a list box.

LB_SETTABSTOPS

wParam = (WPARAM) cTabs; // number of tab stops

lParam = (LPARAM) (LPINT) lpnTabs; // address of tab-stop array

Parameters

cTabs

Value of wParam. Specifies the number of tab stops in the list box.

lpnTabs

Value of lParam. Points to the first member of an array of integers containing the tab stops, in dialog box units. The tab stops must be sorted in ascending order; backward tabs are not allowed.

Return Values

If all the specified tabs are set, the return value is TRUE; otherwise, it is FALSE.

Remarks

To respond to the LB_SETTABSTOPS message, the list box must have been created with the LBS_USETABSTOPS style.

If cTabs parameter is 0 and lpnTabs is NULL, the default tab stop is two dialog box units. If cTabs is 1, the list box will have tab stops separated by the distance specified by lpnTabs.

If lpnTabs points to more than a single value, a tab stop will be set for each value in lpnTabs, up to the number specified by cTabs.

A dialog box unit is a horizontal or vertical distance. One horizontal dialog box unit is equal to 0.25 of the current dialog box base-width unit. These units are computed based on the height and width of the current system font. The GetDialogBaseUnits function returns the current dialog box base units, in pixels.

See Also

GetDialogBaseUnits


 LB_SETTOPINDEX

An application sends an LB_SETTOPINDEX message to ensure that a particular item in a list box is visible.

LB_SETTOPINDEX

wParam = (WPARAM) index; // item index

lParam = 0; // not used; must be zero

Parameters

index

Value of wParam. Specifies the zero-based index of the item in the list box.

Windows 95: The wParam parameter is limited to 16-bit values. This means list boxes cannot contain more than 32,767 items. Although the number of items is restricted, the total size in bytes of the items in a listbox is limited only by available memory.

Return Values

If an error occurs, the return value is LB_ERR.

Remarks

The system scrolls the list box contents so that either the specified item appears at the top of the list box or the maximum scroll range has been reached.

See Also

LB_GETTOPINDEX


 LBItemFromPt

The LBItemFromPt function retrieves the index of the item at the specified point in a list box.

int LBItemFromPt(

HWND hLB,

POINT pt,

BOOL bAutoScroll

);

Parameters

hLB

Handle to the list box to check.

pt

POINT structure that contains the screen coordinates to check.

bAutoScroll

Scroll flag. If this parameter is TRUE and the point is directly above or below the list box, the function scrolls the list box by one line and returns [image] 1. Otherwise, the function does not scroll the list box.

Return Values

The return value is the item identifier if the point is over a list item, or [image] 1 otherwise.

Remarks

The LBItemFromPt function only scrolls the list box if a minimum amount of time has passed since it last did so. Timing prevents the list box from scrolling too quickly if the function is called repeatedly in rapid succession [image] for example, when DL_DRAGGING notification messages or WM_MOUSEMOVE messages are processed.

If the specified point is outside the client area of the list box and bAutoScroll is TRUE, the function scrolls the list box instead of returning an item identifier.

See Also

DL_DRAGGING, POINT , WM_MOUSEMOVE


 LBN_DBLCLK

An application sends the LBN_DBLCLK notification message when the user double-clicks a string in a list box. The parent window of the list box receives this notification message through the WM_COMMAND message.

LBN_DBLCLK

idListBox = (int) LOWORD(wParam); // identifier of list box

hwndListBox = (HWND) lParam; // handle of list box

Remarks

Only a list box that has the LBS_NOTIFY style will send this notification message.

See Also

LBN_SELCHANGE, WM_COMMAND


 LBN_ERRSPACE

An application sends the LBN_ERRSPACE notification message when a list box cannot allocate enough memory to meet a specific request. The parent window of the list box receives this notification message through the WM_COMMAND message.

LBN_ERRSPACE

idListBox = (int) LOWORD(wParam); // identifier of list box

hwndListBox = (HWND) lParam; // handle of list box

See Also

WM_COMMAND


 LBN_KILLFOCUS

An application sends the LBN_KILLFOCUS notification message when a list box loses the keyboard focus. The parent window of the list box receives this notification message through the WM_COMMAND message.

LBN_KILLFOCUS

idListBox = (int) LOWORD(wParam); // identifier of list box

hwndListBox = (HWND) lParam; // handle of list box

See Also

LBN_SETFOCUS, WM_COMMAND


 LBN_SELCANCEL

An application sends the LBN_SELCANCEL notification message when the user cancels the selection in a list box. The parent window of the list box receives this notification message through the WM_COMMAND message.

LBN_SELCANCEL

idListBox = (int) LOWORD(wParam); // identifier of list box

hwndListBox = (HWND) lParam; // handle of list box

Remarks

This notification message applies only to list boxes of the LBS_NOTIFY style.

See Also

LB_SETCURSEL, LBN_DBLCLK, LBN_SELCHANGE, WM_COMMAND


 LBN_SELCHANGE

An application sends the LBN_SELCHANGE notification message when the selection in a list box is about to change. The parent window of the list box receives this notification message through the WM_COMMAND message.

LBN_SELCHANGE

idListBox = (int) LOWORD(wParam); // identifier of list box

hwndListBox = (HWND) lParam; // handle of list box

Remarks

This notification message is not sent if the LB_SETCURSEL message changes the selection.

This notification message applies only to a list box that has the LBS_NOTIFY style.

For a multiple-selection list box, the LBN_SELCHANGE notification is sent whenever the user presses an arrow key, even if the selection does not change.

See Also

LB_SETCURSEL, LBN_DBLCLK, LBN_SELCANCEL, WM_COMMAND


 LBN_SETFOCUS

An application sends the LBN_SETFOCUS notification message when a list box receives the keyboard focus. The parent window of the list box receives this notification message through the WM_COMMAND message.

LBN_SETFOCUS

idListBox = (int) LOWORD(wParam); // identifier of list box

hwndListBox = (HWND) lParam; // handle of list box

See Also

LBN_KILLFOCUS, WM_COMMAND


 LBSELCHSTRING

An Open or Save As dialog box sends the LBSELCHSTRING registered message to your hook procedure when the selection changes in any of the list boxes or combo boxes of the dialog box.

For Explorer-style Open and Save As dialog boxes, this message has been superseded by the CDN_SELCHANGE and CDN_TYPECHANGE messages.

MessageID = RegisterWindowMessage(LBSELCHSTRING);
idListBox = (UINT) wParam;
iItem = LOWORD (lParam);
iType = HIWORD (lParam);

Parameters

idListBox

Identifier of the list box or combo box in which the selection changed.

iItem

Item number of the selected string in the list box or combo box.

iType

Type of selection change. This parameter can be one of the following values:

CD_LBSELCHANGE | The item identified by iItem is the only item selected in a single-selection list box.
CD_LBSELADD | The item identified by iItem is one of the items selected in a multiple-selection list box.
CD_LBSELSUB | The item identified by iItem is no longer selected in a multiple-selection list box.
CD_LBSELNOITEMS | No items exist in a multiple-selection list box.

Return Values

No return value.

Remarks

The hook procedure must specify the LBSELCHSTRING constant in a call to the RegisterWindowMessage function to get the identifier for the message sent by the dialog box.

See Also

CDN_SELCHANGE, CDN_TYPECHANGE, RegisterWindowMessage


start

First topic in project 'aide-messages'


 WM_ACTIVATE

The WM_ACTIVATE message is sent when a window is being activated or deactivated. This message is sent first to the window procedure of the top-level window being deactivated; it is then sent to the window procedure of the top-level window being activated.

WM_ACTIVATE

fActive = LOWORD(wParam); // activation flag

fMinimized = (BOOL) HIWORD(wParam); // minimized flag

hwndPrevious = (HWND) lParam; // window handle

Parameters

fActive

Value of the low-order word of wParam. Specifies whether the window is being activated or deactivated. This parameter can be one of the following values:

Value | Meaning
WA_ACTIVE | Activated by some method other than a mouse click (for example, by a call to the SetActiveWindow function or by use of the keyboard interface to select the window).
WA_CLICKACTIVE | Activated by a mouse click.
WA_INACTIVE | Deactivated.

fMinimized

Value of the high-order word of wParam. Specifies the minimized state of the window being activated or deactivated. A nonzero value indicates the window is minimized.

hwndPrevious

Value of lParam. Identifies the window being activated or deactivated, depending on the value of the fActive parameter. If the value of fActive is WA_INACTIVE, hwndPrevious is the handle of the window being activated. If the value of fActive is WA_ACTIVE or WA_CLICKACTIVE, hwndPrevious is the handle of the window being deactivated. This handle can be NULL.

Return Values

If an application processes this message, it should return zero.

Default Action

If the window is being activated and is not minimized, the DefWindowProc function sets the keyboard focus to the window.

Remarks

If the window is activated by a mouse click, it also receives a WM_MOUSEACTIVATE message.

See Also

DefWindowProc, SetActiveWindow , WM_MOUSEACTIVATE, WM_NCACTIVATE


 WM_ACTIVATEAPP

The WM_ACTIVATEAPP message is sent when a window belonging to a different application than the active window is about to be activated. The message is sent to the application whose window is being activated and to the application whose window is being deactivated.

WM_ACTIVATEAPP

fActive = (BOOL) wParam; // activation flag

dwThreadID = (DWORD) lParam: // thread identifier

Parameters

fActive

Value of wParam. Specifies whether the window is being activated or deactivated. This parameter is TRUE if the window is being activated; it is FALSE if the window is being deactivated.

dwThreadID

Value of lParam. Specifies a thread identifier. If the fActive parameter is TRUE, dwThreadID is the identifier of the thread that owns the window being deactivated. If fActive is FALSE, dwThreadID is the identifier of the thread that owns the window being activated.

Return Values

If an application processes this message, it should return zero.

See Also

WM_ACTIVATE


 WM_ASKCBFORMATNAME

The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.

WM_ASKCBFORMATNAME

cchName = (DWORD) wParam // size of buffer

lpszFormatName = (LPTSTR) lParam // buffer to receive format name

Parameters

cchName

Value of wParam. Specifies the size, in characters, of the buffer pointed to by the lpszFormatName parameter.

lpszFormatName

Value of lParam. Points to the buffer that is to receive the clipboard format name.

Return Values

If an application processes this message, it should return zero.

Remarks

In response to this message, the clipboard owner should copy the name of the owner-display format to the specified buffer, not exceeding the buffer size specified by the cchName parameter.

A clipboard viewer window sends this message to the clipboard owner to determine the name of the CF_OWNERDISPLAY format [image] for example, to initialize a menu listing available formats.


 WM_CANCELJOURNAL

The WM_CANCELJOURNAL message is posted to an application when a user cancels the application's journaling activities. The message is posted with a NULL window handle.

WM_CANCELJOURNAL

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

This message does not return a value. It is meant to be processed from within an application's main loop or a GetMessage hook procedure, not from a window procedure.

Remarks

Journal record and playback modes are modes imposed on the system that let an application sequentially record or play back user input. The system enters these modes when an application installs a JournalRecordProc or JournalPlaybackProc hook procedure. When the system is in either of these journaling modes, applications must take turns reading input from the input queue. If any one application stops reading input while the system is in a journaling mode, other applications are forced to wait.

To ensure a robust system, one that cannot be hung up by any one application, Windows NT automatically cancels any journalling activities when a user presses CTRL+ESC or CTRL+ALT+DEL. The system then unhooks any journaling hook procedures, and posts a WM_CANCELJOURNAL message, with a NULL window handle, to the application that set the journaling hook.

Since the WM_CANCELJOURNAL has a NULL window handle, it cannot be dispatched to a window procedure. There are two ways for an application to see a WM_CANCELJOURNAL message: If the application is running in its own main loop, it must catch the message between its call to GetMessage or PeekMessage and its call to DispatchMessage . If the application is not running in its own main loop, it must set a GetMsgProc hook procedure (via a call to SetWindowsHookEx specifying the WH_GETMESSAGE hook type) that watches for the message.

When an application sees a WM_CANCELJOURNAL message, it can assume two things: the user has intentionally cancelled the journal record or playback mode, and the system has already unhooked any journal record or playback hook procedures.

Note that the key combinations mentioned above (CTRL+ESC or CTRL+ALT+DEL) cause the system to cancel journaling. If any one application is hung, they give the user a means of recovery. The VK_CANCEL virtual keycode (usually implemented as the CTRL+BREAK key combination) is what an application that is in journal record mode should watch for as a signal that the user wishes to cancel the journaling activity. The difference is that watching for VK_CANCEL is a suggested behavior for journaling applications, whereas CTRL+ESC or CTRL+ALT+DEL cause the system to cancel journalling regardless of a journalling application's behavior.

See Also

DispatchMessage, GetMessage , JournalPlaybackProc , JournalRecordProc , GetMsgProc , PeekMessage , SetWindowsHookEx


 WM_CANCELMODE

The WM_CANCELMODE message is sent to the focus window when a dialog box or message box is displayed; this enables the focus window to cancel modes, such as mouse capture.

WM_CANCELMODE

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Default Action

The DefWindowProc function cancels internal processing of standard scroll bar input, cancels internal menu processing, and releases the mouse capture.

See Also

DefWindowProc, ReleaseCapture


 WM_CAPTURECHANGED

The WM_CAPTURECHANGED message is sent to the window that is losing the mouse capture.

WM_CAPTURECHANGED

hwndNewCapture = (HWND) lParam; // handle of window to gain mouse capture

Parameters

hwndNewCapture

Value of lParam. Identifies the window that is gaining the mouse capture.

Return Values

An application should return zero if it processes this message.

Remarks

A window receives this message even if it calls ReleaseCapture itself. An application should not attempt to set the mouse capture in response to this message.

When it receives this message, a window should redraw itself, if necessary, to reflect the new mouse-capture state.

See Also

ReleaseCapture, SetCapture


 WM_CHANGECBCHAIN

The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain.

WM_CHANGECBCHAIN

hwndRemove = (HWND) wParam; // handle of window being removed

hwndNext = (HWND) lParam; // handle of next window in chain

Parameters

hwndRemove

Value of wParam. Identifies the window being removed from the clipboard viewer chain.

hwndNext

Value of lParam. Identifies the next window in the chain following the window being removed. This parameter is NULL if the window being removed is the last window in the chain.

Return Values

If an application processes this message, it should return zero.

Remarks

Each clipboard viewer window saves the handle of the next window in the clipboard viewer chain. Initially, this handle is the return value of the SetClipboardViewer function.

When a clipboard viewer window receives the WM_CHANGECBCHAIN message, it should call the SendMessage function to pass the message to the next window in the chain, unless the next window is the window being removed. In this case, the clipboard viewer should save the handle specified by hwndNext as the next window in the chain.

See Also

SendMessage, SetClipboardViewer


 WM_CHAR

The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the TranslateMessage function. WM_CHAR contains the character code of the key that was pressed.

WM_CHAR

chCharCode = (TCHAR) wParam; // character code

lKeyData = lParam; // key data

Parameters

chCharCode

Value of wParam. Specifies the character code of the key.

lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value | Description
0 [image] 15 | Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key.
16 [image] 23 | Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 | Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25 [image] 28 | Reserved; do not use.
29 | Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.
30 | Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 | Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

Return Values

An application should return zero if it processes this message.

Remarks

Because there is not necessarily a one-to-one correspondence between keys pressed and character messages generated, the information in the high-order word of the lKeyData parameter is generally not useful to applications. The information in the high-order word applies only to the most recent WM_KEYDOWN message that precedes the posting of the WM_CHAR message.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and the right CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Some other keyboards may support the extended-key bit in the lKeyData parameter.

See Also

TranslateMessage, WM_KEYDOWN


 WM_CHARTOITEM

The WM_CHARTOITEM message is sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message.

WM_CHARTOITEM

nKey = LOWORD(wParam); // key value

nCaretPos = HIWORD(wParam); // caret position

hwndListBox = (HWND) lParam; // handle of list box

Parameters

nKey

Value of the low-order word of wParam. Specifies the value of the key the user pressed.

nCaretPos

Value of the high-order word of wParam. Specifies the current position of the caret.

hwndListBox

Value of lParam. Identifies the list box.

Return Values

The return value specifies the action that the application performed in response to the message. A return value of [image] 1 or [image] 2 indicates that the application handled all aspects of selecting the item and requires no further action by the list box. A return value of 0 or greater specifies the zero-based index of an item in the list box and indicates that the list box should perform the default action for the keystroke on the given item.

Default Action

The DefWindowProc function returns [image] 1.

Remarks

Only owner-drawn list boxes that do not have the LBS_HASSTRINGS style can receive this message.

See Also

DefWindowProc, WM_CHAR, WM_VKEYTOITEM


 WM_CHILDACTIVATE

The WM_CHILDACTIVATE message is sent to a multiple document interface (MDI) child window when the user clicks the window's title bar or when the window is activated, moved, or sized.

WM_CHILDACTIVATE

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

See Also

MoveWindow, SetWindowPos


 WM_CHOOSEFONT_GETLOGFONT

Send the WM_CHOOSEFONT_GETLOGFONT message to a Font dialog box to retrieve information about the user's current font selections.

WM_CHOOSEFONT_GETLOGFONT

wParam = 0; // not used, must be zero

lParam = (LPLOGFONT) lplf; // address of struct. with font data

Parameters

lplf

Pointer to a LOGFONT structure that receives information about the user's current font selections.

Return Values

This message does not return a value.

Remarks

The ChooseFont function creates a Font dialog box. When the user closes the Font dialog box, the ChooseFont function returns information about the user's font selections in the CHOOSEFONT structure. The lpLogFont member of the CHOOSEFONT structure is a pointer to a LOGFONT structure.

Use the WM_CHOOSEFONT_GETLOGFONT message to get information about the user's current font selections while the Font dialog box is open. For example, if you enable the Apply button in the Font dialog box, send the message to get the font information to apply to the current text selection.

Typically, you enable a CFHookProc hook procedure to process WM_COMMAND messages for the Apply button. When the user clicks the Apply button, the hook procedure sends the WM_CHOOSEFONT_GETLOGFONT message to the dialog box.

See Also

CFHookProc, ChooseFont , CHOOSEFONT , LOGFONT , WM_COMMAND


 WM_CHOOSEFONT_SETFLAGS

Send the WM_CHOOSEFONT_SETFLAGS message to a Font dialog box to set the display options for the dialog box.

WM_CHOOSEFONT_SETFLAGS

wParam = 0; // not used, must be zero

lParam = (LPCHOOSEFONT) lpcf; // address of struct. with flags data

Parameters

lpcf

Pointer to a CHOOSEFONT structure that contains new settings in the Flags member.

Return Values

No return value.

Remarks

The ChooseFont function creates a Font dialog box and uses a CHOOSEFONT structure to specify the initial values for the Flags member. Use the WM_CHOOSEFONT_SETFLAGS message to specify different values for the Flags member while the Font dialog box is open.

Typically, you should send the WM_CHOOSEFONT_SETFLAGS message from a CFHookProc hook procedure.

See Also

CFHookProc, ChooseFont , CHOOSEFONT


 WM_CHOOSEFONT_SETLOGFONT

Send the WM_CHOOSEFONT_SETLOGFONT message to a Font dialog box to set the current logical font information.

WM_CHOOSEFONT_SETLOGFONT

wParam = 0; // not used, must be zero

lParam = (LPLOGFONT) lplf; // address of struct. with font data

Parameters

lplf

Pointer to a LOGFONT structure that contains information about the current logical font.

Return Values

No return value.

Remarks

When you call the ChooseFont function to create a Font dialog box, you can use the lpLogFont member of the CHOOSEFONT structure to specify a LOGFONT structure containing initial values for the dialog box. Use the WM_CHOOSEFONT_SETLOGFONT message to specify a LOGFONT structure with different values while the Font dialog box is open.

Typically, you would send the WM_CHOOSEFONT_SETLOGFONT message from a CFHookProc hook procedure. The hook procedure can also send the WM_CHOOSEFONT_GETLOGFONT and WM_CHOOSEFONT_SETFLAGS messages.

See Also

CFHookProc, ChooseFont , CHOOSEFONT , LOGFONT , WM_CHOOSEFONT_GETLOGFONT, WM_CHOOSEFONT_SETFLAGS


 WM_CLEAR

An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control.

WM_CLEAR

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

The deletion performed by the WM_CLEAR message can be undone by sending the edit control an EM_UNDO message.

To delete the current selection and place the deleted content on the clipboard, use the WM_CUT message.

When sent to a combo box, the WM_CLEAR message is handled by its edit control. This message has no effect when sent to a combo box with the CBS_DROPDOWNLIST style.

See Also

EM_UNDO, WM_COPY, WM_CUT, WM_PASTE


 WM_CLOSE

The WM_CLOSE message is sent as a signal that a window or an application should terminate.

WM_CLOSE

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Default Action

The DefWindowProc function calls the DestroyWindow function to destroy the window.

Remarks

An application can prompt the user for confirmation, prior to destroying a window, by processing the WM_CLOSE message and calling the DestroyWindow function only if the user confirms the choice.

See Also

DefWindowProc, DestroyWindow


 WM_COMMAND

The WM_COMMAND message is sent when the user selects a command item from a menu, when a control sends a notification message to its parent window, or when an accelerator keystroke is translated.

WM_COMMAND

wNotifyCode = HIWORD(wParam); // notification code

wID = LOWORD(wParam); // item, control, or accelerator identifier

hwndCtl = (HWND) lParam; // handle of control

Parameters

wNotifyCode

Value of the high-order word of wParam. Specifies the notification code if the message is from a control. If the message is from an accelerator, this parameter is 1. If the message is from a menu, this parameter is 0.

wID

Value of the low-order word of wParam. Specifies the identifier of the menu item, control, or accelerator.

hwndCtl

Value of lParam. Identifies the control sending the message if the message is from a control. Otherwise, this parameter is NULL.

Return Values

If an application processes this message, it should return zero.

Remarks

Accelerator keystrokes that select items from the window menu are translated into WM_SYSCOMMAND messages.

If an accelerator keystroke occurs that corresponds to a menu item when the window that owns the menu is minimized, no WM_COMMAND message is sent. However, if an accelerator keystroke occurs that does not match any of the items in the window's menu or in the window menu, a WM_COMMAND message is sent, even if the window is minimized.

If an application enables a menu separator, the system sends a WM_COMMAND message with the low-word of the wParam parameter set to zero when the user selects the separator.

See Also

WM_SYSCOMMAND


 WM_COMPACTING

The WM_COMPACTING message is sent to all top-level windows when Windows detects more than 12.5 percent of system time over a 30- to 60-second interval is being spent compacting memory. This indicates that system memory is low.

WM_COMPACTING

wCompactRatio = wParam; // compacting ratio

Parameters

wCompactRatio

Value of wParam. Specifies the ratio of central processing unit (CPU) time currently spent by Windows compacting memory to CPU time currently spent by Windows performing other operations. For example, 0x8000 represents 50 percent of CPU time spent compacting memory.

Return Values

If an application processes this message, it should return zero.

Remarks

When an application receives this message, it should free as much memory as possible, taking into account the current level of activity of the application and the total number of applications running with Windows.


 WM_COMPAREITEM

Windows sends the WM_COMPAREITEM message to determine the relative position of a new item in the sorted list of an owner-drawn combo box or list box. Whenever the application adds a new item, Windows sends this message to the owner of a combo box or list box created with the CBS_SORT or LBS_SORT style.

WM_COMPAREITEM

idCtl = wParam; // control identifier

lpcis = (LPCOMPAREITEMSTRUCT) lParam; // structure with items

Parameters

idCtl

Value of wParam. Specifies the identifier of the control that sent the WM_COMPAREITEM message.

lpcis

Value of lParam. Points to a COMPAREITEMSTRUCT structure that contains the identifiers and application-supplied data for two items in the combo or list box.

Return Values

The return value indicates the relative position of the two items. It may be any of the following:

Value | Meaning
1 | Item 1 precedes item 2 in the sorted order.
0 | Items 1 and 2 are equivalent in the sorted order.
1 | Item 1 follows item 2 in the sorted order.

Remarks

When the owner of an owner-drawn combo box or list box receives this message, the owner returns a value indicating which of the items specified by the COMPAREITEMSTRUCT structure will appear before the other. Typically, Windows sends this message several times until it determines the exact position for the new item.

See Also

COMPAREITEMSTRUCT


 WM_CONTEXTMENU

The WM_CONTEXTMENU message notifies a window that the user clicked the right mouse button (right clicked) in the window.

hwnd = (HWND) wParam;

xPos = LOWORD(lParam);

yPos = HIWORD(lParam);

Parameters

hwnd

Handle to the window in which the user right clicked the mouse. This can be a child window of the window receiving the message. For more information about processing this message, see the Remarks section.

xPos

Horizontal position of the cursor, in screen coordinates, at the time of the mouse click.

yPos

Vertical position of the cursor, in screen coordinates, at the time of the mouse click.

Return Values

No return value.

Remarks

A window can process this message by displaying a shortcut menu using the TrackPopupMenu or TrackPopupMenuEx function.

If a window does not display a shortcut menu it should pass this message to the DefWindowProc function. If a window is a child window, DefWindowProc sends the message to the parent. Otherwise, DefWindowProc displays a default shortcut menu if the specified position is in the window's caption.

DefWindowProc generates the WM_CONTEXTMENU message when it processes the WM_RBUTTONUP or WM_NCRBUTTONUP message.

See Also

DefWindowProc, TrackPopupMenu , TrackPopupMenuEx , WM_NCRBUTTONUP, WM_RBUTTONUP


 WM_COPY

An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.

WM_COPY

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

When sent to a combo box, the WM_COPY message is handled by its edit control. This message has no effect when sent to a combo box with the CBS_DROPDOWNLIST style.

See Also

WM_CLEAR, WM_CUT, WM_PASTE


 WM_COPYDATA

The WM_COPYDATA message is sent when an application passes data to another application.

WM_COPYDATA

wParam = (WPARAM) (HWND) hwnd; // handle of sending window

lParam = (LPARAM) (PCOPYDATASTRUCT) pcds; // pointer to structure with data

Parameters

hwnd

Identifies the window passing the data.

pcds

Points to a COPYDATASTRUCT structure that contains the data to be passed.

Return Values

If the receiving application processes this message, it should return TRUE; otherwise, it should return FALSE.

Remarks

An application must use the SendMessage function to send this message, not the PostMessage function.

The data being passed must not contain pointers or other references to objects not accessible to the application receiving the data.

While this message is being sent, the referenced data must not be changed by another thread of the sending process.

The receiving application should consider the data read-only. The pcds parameter is valid only during the processing of the message. The receiving application should not free the memory referenced by pcds. If the receiving application must access the data after SendMessage returns, it must copy the data into a local buffer.

See Also

PostMessage, SendMessage , COPYDATASTRUCT


 WM_CPL_LAUNCH

An application sends the WM_CPL_LAUNCH message to Windows Control Panel to request that a Control Panel application be started.

WM_CPL_LAUNCH

hwnd = (HWND) wParam; // handle of sending window

lpszAppName = (LPSTR) lParam; // application-name string

Parameters

hwnd

Value of wParam. Specifies the handle of the window sending the message. The WM_CPL_LAUNCHED message is sent to this window.

lpszAppName

Value of lParam. Specifies a far pointer to a string containing the name of the Control Panel application to open.

Return Values

If the application starts, the return value is TRUE; otherwise, it is FALSE.

See Also

WM_CPL_LAUNCHED


 WM_CPL_LAUNCHED

The WM_CPL_LAUNCHED message is sent when a Control Panel application, started by the WM_CPL_LAUNCH message, has closed. The WM_CPL_LAUNCHED message is sent to the window identified by the wParam parameter of the WM_CPL_LAUNCH message that started the application.

WM_CPL_LAUNCHED

fAppStarted = (BOOL) wParam;

Parameters

fAppStarted

Value of wParam. Specifies whether the application was started. If the application was started, this parameter is TRUE; otherwise, it is FALSE.

Return Values

The value returned by the application is ignored for this message.

See Also

WM_CPL_LAUNCH


 WM_CREATE

The WM_CREATE message is sent when an application requests that a window be created by calling the CreateWindowEx or CreateWindow function. The window procedure of the new window receives this message after the window is created, but before the window becomes visible. The message is sent before the CreateWindowEx or CreateWindow function returns.

WM_CREATE

lpcs = (LPCREATESTRUCT) lParam; // structure with creation data

Parameters

lParam

Value of lParam. Points to a CREATESTRUCT structure that contains information about the window being created. The members of CREATESTRUCT are identical to the parameters of the CreateWindowEx function.

Return Values

If an application processes this message, it should return 0 to continue creation of the window. If the application returns [image] 1, the window is destroyed and the CreateWindowEx or CreateWindow function returns a NULL handle.

See Also

CreateWindow, CreateWindowEx , CREATESTRUCT , WM_NCCREATE


 WM_CTLCOLORBTN

The WM_CTLCOLORBTN message is sent to the parent window of a button when the button is about to be drawn. By responding to this message, the parent window can set a button's text and background colors.

WM_CTLCOLORBTN

hdcButton = (HDC) wParam; // handle of button display context

hwndButton = (HWND) lParam; // handle of button

Parameters

hdcButton

Value of wParam. Identifies the display context for the button.

hwndButton

Value of lParam. Identifies the button.

Return Values

If an application processes this message, it must return the handle of a brush. Windows uses the brush to paint the background of the button.

Default Action

The DefWindowProc function selects the default system colors for the button.

Remarks

The WM_CTLCOLORBTN message is never sent between threads. It is sent only within one thread.

The text color of a check box or radio button applies to the box or button, its check mark, and the text. The focus rectangle for these buttons remains the system default color (typically black). The text color of a group box applies to the text but not to the line that defines the box. The text color of a push button applies only to its focus rectangle; it does not affect the color of the text.

See Also

DefWindowProc, RealizePalette , SelectPalette , WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORMSGBOX, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC


 WM_CTLCOLORDLG

The WM_CTLCOLORDLG message is sent to a dialog box before Windows draws the dialog box. By responding to this message, the dialog box can set its text and background colors by using the given display device context handle.

WM_CTLCOLORDLG

hdcDlg = (HDC) wParam; // handle of dialog box display context

hwndDlg = (HWND) lParam; // handle of dialog box

Parameters

hdcDlg

Value of wParam. Identifies the device context for the dialog box.

hwndDlg

Value of lParam. Identifies the dialog box.

Return Values

If an application processes this message, it must return the handle of a brush. Windows uses the brush to paint the background of the dialog box.

Default Action

The DefWindowProc function selects the default system colors for the dialog box.

Remarks

The WM_CTLCOLORDLG message is never sent between threads. It is sent only within one thread.

Note that the WM_CTLCOLORDLG message is sent to the dialog box itself; all of the other WM_CTLCOLOR* messages are sent to the owner of the control.

See Also

DefWindowProc, RealizePalette , SelectPalette , WM_CTLCOLORBTN, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORMSGBOX, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC


 WM_CTLCOLOREDIT

The WM_CTLCOLOREDIT message is sent to the parent window of an edit control when the control is about to be drawn. By responding to this message, the parent window can use the given device context handle to set the text and background colors of the edit control.

WM_CTLCOLOREDIT

hdcEdit = (HDC) wParam; // handle of display context

hwndEdit = (HWND) lParam; // handle of static control

Parameters

hdcEdit

Value of wParam. Identifies the device context for the edit control window.

hwndEdit

Value of lParam. Identifies the edit control.

Return Values

If an application processes this message, it must return the handle of a brush. Windows uses the brush to paint the background of the edit control.

Default Action

The DefWindowProc function selects the default system colors for the edit control.

Remarks

The WM_CTLCOLOREDIT message is never sent between threads, it is only sent within the same thread.

See Also

DefWindowProc, RealizePalette , SelectPalette , WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLORLISTBOX, WM_CTLCOLORMSGBOX, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC


 WM_CTLCOLORLISTBOX

The WM_CTLCOLORLISTBOX message is sent to the parent window of a list box before Windows draws the list box. By responding to this message, the parent window can set the text and background colors of the list box by using the given display device context handle.

WM_CTLCOLORLISTBOX

hdcLB = (HDC) wParam; // handle of list box display context

hwndLB = (HWND) lParam; // handle of list box

Parameters

hdcLB

Value of wParam. Identifies the device context for the list box.

hwndLB

Value of lParam. Identifies the list box.

Return Values

If an application processes this message, it must return the handle of a brush. Windows uses the brush to paint the background of the list box.

Default Action

The DefWindowProc function selects the default system colors for the list box.

Remarks

The WM_CTLCOLORLISTBOX message is never sent between threads. It is sent only within one thread.

See Also

DefWindowProc, RealizePalette , SelectPalette , WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORMSGBOX, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC


 WM_CTLCOLORMSGBOX

The WM_CTLCOLORMSGBOX message is sent to the owner window of a message box before Windows draws the message box. By responding to this message, the owner window can set the text and background colors of the message box by using the given display device context handle.

WM_CTLCOLORMSGBOX

hdcMB = (HDC) wParam; // handle of message box display context

hwndMB = (HWND) lParam; // handle of message box

Parameters

hdcMB

Value of wParam. Identifies the device context for the message box.

hwndMB

Value of lParam. Identifies the message box.

Return Values

If an application processes this message, it must return the handle of a brush. Windows uses the brush to paint the background of the message box.

Default Action

The DefWindowProc function selects the default system colors for the message box.

Remarks

The WM_CTLCOLORMSGBOX message is never sent between threads. It is sent only within one thread.

See Also

DefWindowProc, RealizePalette , SelectPalette , WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORSCROLLBAR, WM_CTLCOLORSTATIC


 WM_CTLCOLORSCROLLBAR

The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a scroll bar control when the control is about to be drawn. By responding to this message, the parent window can use the given display context handle to set the background color of the scroll bar control.

WM_CTLCOLORSCROLLBAR

hdcSB = (HDC) wParam; // handle of scroll-bar display context

hwndSB = (HWND) lParam; // handle of scroll bar

Parameters

hdcSB

Value of wParam. Identifies the device context for the scroll bar control.

hwndSB

Value of lParam. Identifies the scroll bar.

Return Values

If an application processes this message, it must return the handle of a brush. Windows uses the brush to paint the background of the scroll bar control.

Default Action

The DefWindowProc function selects the default system colors for the scroll bar control.

Remarks

The WM_CTLCOLORSCROLLBAR message is never sent between threads; it is only sent within the same thread.

See Also

DefWindowProc, RealizePalette , SelectPalette , WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORMSGBOX, WM_CTLCOLORSTATIC


 WM_CTLCOLORSTATIC

The WM_CTLCOLORSTATIC message is sent to the parent window of a static control when the control is about to be drawn. By responding to this message, the parent window can use the given device context handle to set the text and background colors of the static control.

WM_CTLCOLORSTATIC

hdcStatic = (HDC) wParam; // handle of display context

hwndStatic = (HWND) lParam; // handle of static control

Parameters

hdcStatic

Value of wParam. Identifies the device context for the static control window.

hwndStatic

Value of lParam. Identifies the static control.

Return Values

If an application processes this message, the return value is the handle of a brush that Windows uses to paint the background of the static control.

Default Action

The DefWindowProc function selects the default system colors for the static control.

Remarks

The WM_CTLCOLORSTATIC message is never sent between threads; it is sent only within the same thread.

See Also

DefWindowProc, RealizePalette , SelectPalette , WM_CTLCOLORBTN, WM_CTLCOLORDLG, WM_CTLCOLOREDIT, WM_CTLCOLORLISTBOX, WM_CTLCOLORMSGBOX, WM_CTLCOLORSCROLLBAR


 WM_CUT

An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format.

WM_CUT

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

The deletion performed by the WM_CUT message can be undone by sending the edit control an EM_UNDO message.

To delete the current selection without placing the deleted text on the clipboard, use the WM_CLEAR message.

When sent to a combo box, the WM_CUT message is handled by its edit control. This message has no effect when sent to a combo box with the CBS_DROPDOWNLIST style.

See Also

EM_UNDO, WM_CLEAR, WM_COPY, WM_PASTE


 WM_DDE_ACK

The WM_DDE_ACK message notifies a DDE application of the receipt and processing of a WM_DDE_POKE, WM_DDE_EXECUTE, WM_DDE_DATA, WM_DDE_ADVISE, WM_DDE_UNADVISE, or WM_DDE_INITIATE message, and in some cases, of a WM_DDE_REQUEST message.

WM_DDE_ACK

// Response to WM_DDE_INITIATE

wParam = (WPARAM) hwnd; // handle of posting application

lParam = MAKELPARAM(aApp, aTopic) // application and topic atoms

// Response to WM_DDE_EXECUTE

wParam = (WPARAM) hwnd; // handle of posting application

lParam = (LPARAM) lPackedVal; // packed status flags and data handle

// Response to all other messages

wParam = (WPARAM) hwnd; // handle of posting application

lParam = (LPARAM) lPackedVal; // packed status flags and item

Parameters

When responding to WM_DDE_INITIATE:

hwnd

Value of wParam. Identifies the server window posting the message.

aApp

Value of the low-order word of lParam. Contains an atom that identifies the replying application.

aTopic

Value of the high-order word of lParam. Contains an atom that identifies the topic for which a conversation is being established.

When responding to WM_DDE_EXECUTE:

hwnd

Value of wParam. Identifies the server window posting the message.

lPackedVal

Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is wStatus. The high-order word is the same hCommands that was received in the WM_DDE_EXECUTE message.

Parameter | Description
wStatus | Specifies a DDEACK structure containing a series of flags that indicate the status of the response.
hCommands | Identifies a global memory object that contains the command string.

When replying to all other messages:

hwnd

Value of wParam. Identifies the client or server window posting the message.

lPackedVal

Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is wStatus. The high-order word is aItem.

Parameter | Description
wStatus | Specifies a DDEACK structure containing a series of flags that indicate the status of the response.
aItem | Contains a global atom that identifies the name of the data item for which the response is sent.

Remarks

Posting

Except in response to the WM_DDE_INITIATE message, the application posts the WM_DDE_ACK message by calling the PostMessage function, not by calling the SendMessage function. When responding to WM_DDE_INITIATE, the application sends the WM_DDE_ACK message by calling SendMessage. In this case, neither the application-name atom nor the topic-name atom should be NULL (even if the WM_DDE_INITIATE message specified NULL atoms).

When acknowledging any message with an accompanying aItem atom, the application posting WM_DDE_ACK can either reuse the aItem atom that accompanied the original message, or it can delete it and create a new one.

When acknowledging WM_DDE_EXECUTE, the application that posts WM_DDE_ACK should reuse the global memory object identified in the original WM_DDE_EXECUTE message.

All posted WM_DDE_ACK messages must create or reuse the lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function.

If an application has initiated the termination of a conversation by posting WM_DDE_TERMINATE and is awaiting confirmation, the waiting application should not acknowledge (positively or negatively) any subsequent messages sent by the other application. The waiting application should delete any atoms or shared memory objects received in these intervening messages. Memory objects should not be freed if the fRelease flag is set to FALSE in WM_DDE_POKE, and WM_DDE_DATA messages.

Receiving

The application that receives a WM_DDE_ACK message should delete all atoms accompanying the message. If the application receives a WM_DDE_ACK in response to a message with an accompanying hData object, and the object was sent with the fRelease flags set to FALSE, the application is responsible for deleteing the hData object.

If the application receives a negative WM_DDE_ACK message posted in reply to a WM_DDE_ADVISE message, the application should delete the global memory object posted with the original WM_DDE_ADVISE message (in hOptions). If the application receives a negative WM_DDE_ACK message posted in reply to a WM_DDE_DATA, WM_DDE_POKE, or WM_DDE_EXECUTE message, the application should delete the global memory object posted with the original WM_DDE_DATA, WM_DDE_POKE, or WM_DDE_EXECUTE message (in hCommands).

The application that receives a posted WM_DDE_ACK message must free the lPackedVal parameter by using the FreeDDElParam function.

See Also

DDEACK, FreeDDElParam , PackDDElParam , PostMessage , ReuseDDElParam , SendMessage , UnpackDDElParam , WM_DDE_ADVISE, WM_DDE_DATA, WM_DDE_EXECUTE, WM_DDE_INITIATE, WM_DDE_POKE, WM_DDE_REQUEST, WM_DDE_TERMINATE, WM_DDE_UNADVISE


 WM_DDE_ADVISE

A DDE client application posts the WM_DDE_ADVISE message to a DDE server application to request the server to supply an update for a data item whenever the item changes.

WM_DDE_ADVISE

wParam = (WPARAM) hwnd; // handle of posting application

lParam = (LPARAM) lPackedVal; // packed DDEADVISE and item atom

Parameters

hwnd

Value of wParam. Identifies the client window posting the message.

lPackedVal

Value of lParam. The component parameters packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hOptions. The high-order word is aItem.

Parameter | Description
hOptions | Identifies a global memory object containing a DDEADVISE structure that specifies how the data is to be sent.
aItem | Contains an atom that identifies the requested data item.

Remarks

If a client application supports more than one clipboard format for a single topic and item, it can post multiple WM_DDE_ADVISE messages for the topic and item, specifying a different clipboard format with each message. Note that a server can support multiple formats only for hot data links, not warm data links.

Posting

The client application posts the WM_DDE_ADVISE message by calling the PostMessage function, not the SendMessage function.

The client application allocates hOptions by calling the GlobalAlloc function with the GMEM_DDESHARE option. It allocates aItem by calling the GlobalAddAtom function.

The client application must create or reuse the WM_DDE_ADVISE lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hOptions supplied as the low-order word and aItem supplied as the high-order word.

If the receiving (server) application responds with a negative WM_DDE_ACK message, the posting (client) application must delete the hOptions object.

The fRelease flag is not used in WM_DDE_ADVISE messages, but their data-freeing behavior is similar to that of WM_DDE_DATA and WM_DDE_POKE messages where fRelease is TRUE.

Receiving

The server application posts the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the application can reuse the aItem atom or delete it and create a new one. If the WM_DDE_ACK message is positive, the application should delete the hOptions object; otherwise, the application should not delete the object.

The server must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word.

See Also

DDEADVISE, FreeDDElParam , GlobalAddAtom , GlobalAlloc , PackDDElParam , PostMessage , ReuseDDElParam , SendMessage , UnpackDDElParam , WM_DDE_ACK, WM_DDE_DATA, WM_DDE_POKE, WM_DDE_REQUEST


 WM_DDE_DATA

A DDE server application posts a WM_DDE_DATA message to a DDE client application to pass a data item to the client or to notify the client of the availability of a data item.

WM_DDE_DATA

wParam = (WPARAM) hwnd; // handle of posting application

lParam = (LPARAM) lPackedVal; // packed DDEDATA and item atom

Parameters

hwnd

Value of wParam. Identifies the server window posting the message.

lPackedVal

Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hData or NULL. The high-order word is aItem.

Parameter | Description
hData | Identifies a global memory object containing a DDEDATA structure with the data and additional information. The handle should be set to NULL if the server is notifying the client that the data-item value has changed during a warm data link. A warm link is established by the client sending a WM_DDE_ADVISE message with the fDeferUpd bit set.
aItem | Contains an atom that identifies the data item for which the data or notification is sent.

Remarks

Posting

The server application posts the WM_DDE_DATA message by calling the PostMessage function, not the SendMessage function.

The server application allocates hData by calling the GlobalAlloc function with the GMEM_DDESHARE option. It allocates aItem by calling the GlobalAddAtom function.

The server must create or reuse the WM_DDE_DATA lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hData supplied as the low-order word and aItem supplied as the high-order word.

If the receiving (client) application responds with a negative WM_DDE_ACK message, the posting (server) application must delete the hData object; otherwise, the client must delete the hData object after extracting its contents by calling the UnpackDDElParam function.

If the server application sets the fRelease member of the DDEDATA structure to FALSE, the server is responsible for deleting hData upon receiving either a positive or negative acknowledgement.

The server application should not set both the fAckReq and fRelease members of the DDEDATA structure to FALSE. If both members are set to FALSE, it is impossible for the server to determine when to delete hData.

Receiving

If fAckReq is TRUE, the client application should post the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the client can either reuse the aItem atom, or it can delete it and create a new one.

The client must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word.

If fAckReq is FALSE, the client application should delete the aItem atom.

If the posting (server) application specified hData as NULL, the receiving (client) application can request the server to send the data by posting a WM_DDE_REQUEST message.

After processing a WM_DDE_DATA message in which hData is not NULL, the client should free hData, unless one of the following conditions is true:

  • The fRelease member is FALSE.

  • The fRelease member is TRUE, but the client application responds with a negative WM_DDE_ACK message.

See Also

DDEDATA, FreeDDElParam , GlobalAddAtom , GlobalAlloc , PackDDElParam , PostMessage , ReuseDDElParam , SendMessage , UnpackDDElParam , WM_DDE_ACK, WM_DDE_ADVISE, WM_DDE_POKE, WM_DDE_REQUEST


 WM_DDE_EXECUTE

A DDE client application posts a WM_DDE_EXECUTE message to a DDE server application to send a string to the server to be processed as a series of commands. The server application is expected to post a WM_DDE_ACK message in response.

WM_DDE_EXECUTE

wParam = (WPARAM) hwnd; // handle of posting application

lParam = (LPARAM) hCommands; // handle to global object

Parameters

hwnd

Value of wParam. Identifies the client window posting the message.

hCommands

Value of lParam. Contains a global memory object that references an ANSI or Unicode command string, depending on the types of windows involved in the conversation.

Remarks

The command string is a null-terminated string consisting of one or more opcode strings enclosed in single brackets ([ ]).

Each opcode string has the following syntax, where the parameters list is optional:

opcode parameters

The opcode is any application-defined single token. It cannot include spaces, commas, parentheses, brackets, or quotation marks.

The parameters list can contain any application-defined value or values. Multiple parameters are separated by commas, and the entire parameter list is enclosed in parentheses. Parameters cannot include commas or parentheses except inside a quoted string. If a bracket or parenthesis character is to appear in a quoted string, it need not be doubled, as was the case under the old rules.

Following are some valid command strings:

[connect][download(query1,results.txt)][disconnect]

[query("sales per employee for each district")]

[open("sample.xlm")][run("r1c1")]

[quote_case("This is a "" character")]

[bracket_or_paren_case("()s or []s should be no problem.")]

Note that, under the old rules, parentheses and brackets had to be doubled, as follows:

[bracket_or_paren_case("(())s or [[]]s should be no problem.")]

Servers should be able to parse commands in either form.

Unicode execute strings should be used only when both the client and server window handles cause the IsWindowUnicode function to return TRUE.

Posting

The client application posts the WM_DDE_EXECUTE message by calling the PostMessage function, not the SendMessage function.

The client application allocates hCommands by calling the GlobalAlloc function with the GMEM_DDESHARE option.

When processing the WM_DDE_ACK message that the server posts in reply to a WM_DDE_EXECUTE message, the client application must delete the hCommands object sent back in the WM_DDE_ACK message.

Receiving

The server application posts the WM_DDE_ACK message to respond positively or negatively. The server should reuse the hCommands object.

Unless specified otherwise by a sub-protocol, the server should not post the WM_DDE_ACK message until all the actions specified by the execute command string are completed. The one exception to this rule is when the string causes the server to terminate the conversation.

See Also

GlobalAlloc, IsWindowUnicode , PackDDElParam , PostMessage , ReuseDDElParam , SendMessage , UnpackDDElParam , WM_DDE_ACK


 WM_DDE_INITIATE

A DDE client application sends a WM_DDE_INITIATE message to initiate a conversation with a server application responding to the specified application and topic names. Upon receiving this message, all server applications with names that match the specified application and that support the specified topic are expected to acknowledge it. (For more information, see the WM_DDE_ACK message.)

WM_DDE_INITIATE

wParam = (WPARAM) hwnd; // handle of posting appl.

lParam = MAKELPARAM(aApp, aTopic); // appl. and topic atoms

Parameters

hwnd

Value of wParam. Identifies the client window sending the message.

aApp

Value of the low-order word of lParam. Contains an atom that identifies the application with which a conversation is requested. The application name cannot contain slashes (/) or backslashes (\). These characters are reserved for network implementations. If aApp is NULL, a conversation with all applications is requested.

aTopic

Value of the high-order word of lParam. Contains an atom that identifies the topic for which a conversation is requested. If the topic is NULL, conversations for all available topics are requested.

Remarks

If aApp is NULL, any server application can respond. If aTopic is NULL, any topic is valid. Upon receiving a WM_DDE_INITIATE request with the aTopic parameter set to NULL, a server must send a WM_DDE_ACK message for each of the topics it supports.

Sending

The client application sends WM_DDE_INITIATE by calling the SendMessage function, not the PostMessage function. The client broadcasts the message to all top-level windows by setting the first parameter of SendMessage to [image] 1.

If the client application has already obtained the window handle of the desired server, it can send WM_DDE_INITIATE directly to the server window by passing the server's window handle as the first parameter of SendMessage.

The client application allocates aApp and aTopic by calling GlobalAddAtom .

When SendMessage returns, the client application must delete the aApp and aTopic atoms.

Receiving

To complete the initiation of a conversation, the server application must respond with one or more WM_DDE_ACK messages, where each message is for a separate topic. When sending WM_DDE_ACK message, the server should create new aApp and aTopic atoms; it should not reuse the atoms sent with WM_DDE_INITIATE.

See Also

GlobalAddAtom, GlobalAlloc , PostMessage , SendMessage , WM_DDE_ACK


 WM_DDE_POKE

A DDE client application posts a WM_DDE_POKE message to a DDE server application. A client uses this message to request the server to accept an unsolicited data item. The server is expected to reply with a WM_DDE_ACK message indicating whether it accepted the data item.

WM_DDE_POKE

wParam = (WPARAM) hwnd; // handle of posting application

lParam = (LPARAM) lPackedVal; // packed DDEPOKE and item atom

Parameters

hwnd

Value of wParam. Identifies the client window posting the message.

lPackedVal

Value of lParam. The component parameters that are packed into lPackedVal are extracted by calling the UnpackDDElParam function. The low-order word is hData. The high-order word is aItem.

Parameter | Description
hData | Identifies a global memory object containing a DDEPOKE structure with the data and additional information.
aItem | Contains a global atom that identifies the data item for which the data or notification is being sent.

Remarks

Posting

The client application posts the WM_DDE_POKE message by using the PostMessage function.

The client application must allocate memory for the hData object by using the GlobalAlloc function with the GMEM_DDESHARE option. The client application must delete the hData object if either of the following conditions is true:

  • The server application responds with a negative WM_DDE_ACK message.

  • The fRelease member is FALSE, but the server application responds with either a positive or negative WM_DDE_ACK.

The client application must create the aItem atom by using the GlobalAddAtom function.

The client application must create or reuse the WM_DDE_POKE lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with hData supplied as the low-order word and aItem supplied as the high-order word.

Receiving

The server application should post the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the server can either reuse the aItem atom, or it can delete it and create a new one.

The server must create or reuse the WM_DDE_ACK lPackedVal parameter by calling the PackDDElParam function or the ReuseDDElParam function with wStatus supplied as the low-order word and aItem supplied as the high-order word.

To free the hData object, the server should call the GlobalFree function. Also, if the data format is either CF_DSPMETAFILEPICT or CF_METAFILEPICT, the server must also call DeleteMetaFile with the embedded metafile handle. These two formats have an extra level of indirection; that is, an application must lock hData to get a pointer to a handle, then lock that handle to get a pointer to a METAFILEPICT structure, and finally call DeleteMetaFile with the handle from the hMF member of the METAFILEPICT structure.

To free the lPackedVal object, the server should call the FreeDDElParam function.

See Also

DDEPOKE, DeleteMetaFile , FreeDDElParam , GlobalAddAtom , GlobalAlloc , GlobalFree , METAFILEPICT , PackDDElParam , PostMessage , ReuseDDElParam , SendMessage , UnpackDDElParam , WM_DDE_ACK


 WM_DDE_REQUEST

A DDE client application posts a WM_DDE_REQUEST message to a DDE server application to request the value of a data item.

WM_DDE_REQUEST

wParam = (WPARAM) hwnd; // handle of posting application

lParam = (LPARAM) lParam; // holds cfFormat and aItem

Parameters

hwnd

Value of wParam. Identifies the client window sending the message.

lParam

Holds the cfFormat and aItem parameters.

Parameter | Description
cfFormat | This is the LOWORD of lParam. Specifies a standard or registered clipboard format.
aItem | This is the HIWORD of lParam. Contains an atom that identifies the data item requested from the server.

Remarks

Posting

The client application posts the WM_DDE_REQUEST message by calling the PostMessage function, not the SendMessage function.

The client application allocates aItem by calling the GlobalAddAtom function.

Receiving

If the receiving (server) application can satisfy the request, it responds with a WM_DDE_DATA message containing the requested data. Otherwise, it responds with a negative WM_DDE_ACK message.

When responding with either a WM_DDE_DATA or WM_DDE_ACK message, the server application can either reuse the aItem atom or it can delete the atom and create a new one.

See Also

GlobalAddAtom, PackDDElParam , PostMessage , ReuseDDElParam , SendMessage , UnpackDDElParam , WM_DDE_ACK, WM_DDE_DATA


 WM_DDE_TERMINATE

A DDE application (client or server) posts a WM_DDE_TERMINATE message to terminate a conversation.

WM_DDE_TERMINATE

wParam = (WPARAM) hwnd; // handle of posting window

lParam = 0; // not used, must be zero

Parameters

hwnd

Value of wParam. Identifies the client or server window posting the message.

Remarks

Posting

The client or server application posts the WM_DDE_TERMINATE message by calling the PostMessage function, not the SendMessage function.

While waiting for confirmation of the termination, the posting application should not post any other messages to the receiving application. If the sending application receives messages (other than WM_DDE_TERMINATE) from the receiving application, it should delete any atoms or shared memory objects accompanying the messages, except hData objects associated with WM_DDE_POKE or WM_DDE_DATA messages that do not have the fRelease flag set.

Receiving

The client or server application should respond by posting a WM_DDE_TERMINATE message.

See Also

PostMessage, SendMessage , WM_DDE_DATA, WM_DDE_POKE


 WM_DDE_UNADVISE

A DDE client application posts a WM_DDE_UNADVISE message to inform a DDE server application that the specified item or a particular clipboard format for the item should no longer be updated. This terminates the warm or hot data link for the specified item.

WM_DDE_UNADVISE

wParam = (WPARAM) hwnd; // handle of posting application

lParam = (LPARAM) lParam; // format and item atom

Parameters

hwnd

Value of wParam. Identifies the client window sending the message.

lParam

Holds the cfFormat and aItem parameters.

Parameter | Description
cfFormat | This is the LOWORD of lParam. Specifies the clipboard format of the item for which the update request is being retracted. If cfFormat is NULL, all active WM_DDE_ADVISE conversations for the item are to be terminated.
aItem | This is the HIWORD of lParam. Contains a global atom that identifies the item for which the update request is being retracted. When aItem is NULL, all active WM_DDE_ADVISE links associated with the conversation are to be terminated.

Remarks

Posting

The client application posts the WM_DDE_UNADVISE message by calling the PostMessage function, not the SendMessage function.

The client application allocates aItem by calling the GlobalAddAtom function.

Receiving

The server application posts the WM_DDE_ACK message to respond positively or negatively. When posting WM_DDE_ACK, the server can either reuse the aItem atom, or it can delete the atom and create a new one.

See Also

GlobalAddAtom, PackDDElParam , PostMessage , ReuseDDElParam , SendMessage , UnpackDDElParam , WM_DDE_ACK, WM_DDE_ADVISE


 WM_DEADCHAR

WM_DEADCHAR

chCharCode = (TCHAR) wParam; // character code

lKeyData = lParam; // key data

The WM_DEADCHAR message is posted to the window with the keyboard focus when a WM_KEYUP message is translated by the TranslateMessage function. WM_DEADCHAR specifies a character code generated by a dead key. A dead key is a key that generates a character, such as the umlaut (double-dot), that is combined with another character to form a composite character. For example, the umlaut-O character (Ö) is generated by typing the dead key for the umlaut character, and then typing the O key.

Parameters

chCharCode

Value of wParam. Specifies the character code generated by the dead key.

lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value | Description
0 [image] 15 | Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key.
16 [image] 23 | Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 | Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25 [image] 28 | Reserved; do not use.
29 | Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.
30 | Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 | Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

Return Values

An application should return zero if it processes this message.

Remarks

The WM_DEADCHAR message typically is used by applications to give the user feedback about each key pressed. For example, an application can display the accent in the current character position without moving the caret.

Because there is not necessarily a one-to-one correspondence between keys pressed and character messages generated, the information in the high-order word of the lKeyData parameter is generally not useful to applications. The information in the high-order word applies only to the most recent WM_KEYDOWN message that precedes the posting of the WM_DEADCHAR message.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and the right CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Some other keyboards may support the extended-key bit in the lKeyData parameter.

See Also

TranslateMessage, WM_KEYDOWN, WM_KEYUP, WM_SYSDEADCHAR


 WM_DELETEITEM

The WM_DELETEITEM message is sent to the owner of a list box or combo box when the list box or combo box is destroyed or when items are removed by the LB_DELETESTRING, LB_RESETCONTENT, CB_DELETESTRING, or CB_RESETCONTENT message. Windows sends a WM_DELETEITEM message for each deleted item. Windows sends the WM_DELETEITEM message for any deleted list box or combo box item with nonzero item data.

WM_DELETEITEM

idCtl = wParam; // control identifier

lpdis = (LPDELETEITEMSTRUCT) lParam; // structure with item information

Parameters

idCtl

Value of wParam. Specifies the identifier of the control that sent the WM_DELETEITEM message.

lpdis

Value of lParam. Points to a DELETEITEMSTRUCT structure that contains information about the item deleted from a list box.

Return Values

An application should return TRUE if it processes this message.

See Also

CB_DELETESTRING, CB_RESETCONTENT, DELETEITEMSTRUCT , LB_DELETESTRING, LB_RESETCONTENT


 WM_DESTROY

The WM_DESTROY message is sent when a window is being destroyed. It is sent to the window procedure of the window being destroyed after the window is removed from the screen.

This message is sent first to the window being destroyed and then to the child windows (if any) as they are destroyed. During the processing of the message, it can be assumed that all child windows still exist.

WM_DESTROY

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Remarks

If the window being destroyed is part of the clipboard viewer chain (set by calling the SetClipboardViewer function), the window must remove itself from the chain by processing the ChangeClipboardChain function before returning from the WM_DESTROY message.

See Also

ChangeClipboardChain, DestroyWindow , PostQuitMessage , SetClipboardViewer , WM_CLOSE


 WM_DESTROYCLIPBOARD

The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard.

WM_DESTROYCLIPBOARD

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

See Also

EmptyClipboard


 WM_DEVICECHANGE

The WM_DEVICECHANGE device message notifies an application or device driver of a change to the hardware configuration of a device or the computer.

Event = (UINT) wParam;
dwData = (DWORD) lParam;

Parameters

Event

Event type. This parameter can be one of the following values:

Value | Meaning
DBT_CONFIGCHANGECANCELED | A request to change the current configuration (dock or undock) has been canceled.
DBT_CONFIGCHANGED | The current configuration has changed, due to a dock or undock.
DBT_DEVICEARRIVAL | A device has been inserted and is now available.
DBT_DEVICEQUERYREMOVE | Permission is requested to remove a device. Any application can deny this request and cancel the removal.
DBT_DEVICEQUERYREMOVEFAILED | A request to remove a device has been canceled.
DBT_DEVICEREMOVECOMPLETE | A device has been removed.
DBT_DEVICEREMOVEPENDING | A device is about to be removed. Cannot be denied.
DBT_DEVICETYPESPECIFIC | A device-specific event has occurred.
DBT_QUERYCHANGECONFIG | Permission is requested to change the current configuration (dock or undock).
DBT_USERDEFINED | The meaning of this message is user-defined.

dwData

Address of a structure that contains event-specific data. Its meaning depends on the given event.

Return Values

Return TRUE to grant a requested action.

Return QUERY_BROADCAST_DENY to deny a requested action.

Remarks

For devices that offer software-controllable features, such as ejection and locking, the operating system typically sends a DBT_DEVICEREMOVEPENDING message to let applications and device drivers end their use of the device gracefully.

If the operating system forcibly removes a device, it may not send a DBT_DEVICEQUERYREMOVE message before doing so.

DBT_CONFIGCHANGECANCELED, DBT_CONFIGCHANGED, DBT_DEVICEARRIVAL, DBT_DEVICEQUERYREMOVE, DBT_DEVICEQUERYREMOVEFAILED, DBT_DEVICEREMOVECOMPLETE, DBT_DEVICEREMOVEPENDING, DBT_DEVICETYPESPECIFIC, DBT_QUERYCHANGECONFIG, DBT_USERDEFINED


 WM_DEVMODECHANGE

The WM_DEVMODECHANGE message is sent to all top-level windows whenever the user changes device-mode settings.

WM_DEVMODECHANGE

lpszDev = (LPCTSTR) lParam; // address of device name

Parameters

lpszDev

Value of lParam. Points to the device name specified in the WIN.INI file.

Return Values

An application should return zero if it processes this message.

Remarks

Windows NT: Calls to functions that change the WIN.INI file may be mapped to the registry instead. This mapping occurs when WIN.INI and the section being changed are specified in the registry under the following keys:

HKEY_LOCAL_MACHINE\Software\Description\Microsoft\
Windows NT\CurrentVersion\IniFileMapping

The change in the storage location has no effect on the behavior of this message.

See Also

WM_WININICHANGE


 WM_DISPLAYCHANGE

The WM_DISPLAYCHANGE message is sent to all windows when the display resolution has changed.

WM_DISPLAYCHANGE

cBitsPerPixel = wParam;

cxScreen = LOWORD(lParam);

cyScreen = HIWORD(lParam);

Parameters

cBitsPerPixel

Specifies the new image depth of the display in bits per pixel.

cxScreen

Specifies the new horizontal resolution of the screen.

cyScreen

Specifies the new vertical resolution of the screen.


 WM_DRAWCLIPBOARD

The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard.

WM_DRAWCLIPBOARD

Parameters

This message has no parameters.

Remarks

Only clipboard viewer windows receive this message. These are windows that have been added to the clipboard viewer chain by using the SetClipboardViewer function.

Each window that receives the WM_DRAWCLIPBOARD message must call the SendMessage function to pass the message on to the next window in the clipboard viewer chain. The handle of the next window in the chain is returned by SetClipboardViewer, and may change in response to a WM_CHANGECBCHAIN message.

See Also

SendMessage, SetClipboardViewer , WM_CHANGECBCHAIN


 WM_DRAWITEM

The WM_DRAWITEM message is sent to the owner window of an owner-drawn button, combo box, list box, or menu when a visual aspect of the button, combo box, list box, or menu has changed.

WM_DRAWITEM

idCtl = (UINT) wParam; // control identifier

lpdis = (LPDRAWITEMSTRUCT) lParam; // item-drawing information

Parameters

idCtl

Value of wParam. Specifies the identifier of the control that sent the WM_DRAWITEM message. If the message was sent by a menu, this parameter is zero.

lpdis

Value of lParam. Points to a DRAWITEMSTRUCT structure containing information about the item to be drawn and the type of drawing required.

Return Values

If an application processes this message, it should return TRUE.

Default Action

The DefWindowProc function draws the focus rectangle for an owner-drawn list box item.

Remarks

The itemAction member of the DRAWITEMSTRUCT structure specifies the drawing operation that an application should perform.

Before returning from processing this message, an application should ensure that the device context identified by the hDC member of the DRAWITEMSTRUCT structure is in the default state.

See Also

DefWindowProc, DRAWITEMSTRUCT


 WM_DROPFILES

The WM_DROPFILES message is sent when the user releases the left mouse button while the cursor is in the window of an application that has registered itself as a recipient of dropped files.

WM_DROPFILES

hDrop = (HANDLE) wParam; // handle of internal drop structure

Parameters

hDrop

Value of wParam. Identifies an internal structure describing the dropped files. This handle is used by the DragFinish, DragQueryFile, and DragQueryPoint functions to retrieve information about the dropped files.

Return Values

An application should return zero if it processes this message.

See Also

DragAcceptFiles, DragFinish , DragQueryFile , DragQueryPoint


 WM_ENABLE

The WM_ENABLE message is sent when an application changes the enabled state of a window. It is sent to the window whose enabled state is changing. This message is sent before the EnableWindow function returns, but after the enabled state (WS_DISABLED style bit) of the window has changed.

WM_ENABLE

fEnabled = (BOOL) wParam; // enabled/disabled flag

Parameters

fEnabled

Value of wParam. Specifies whether the window has been enabled or disabled. This parameter is TRUE if the window has been enabled or FALSE if the window has been disabled.

Return Values

If an application processes this message, it should return zero.

See Also

EnableWindow


 WM_ENDSESSION

The WM_ENDSESSION message is sent to an application after Windows processes the results of the WM_QUERYENDSESSION message. The WM_ENDSESSION message informs the application whether the Windows session is ending.

WM_ENDSESSION

fEndSession = (BOOL) wParam; // end-session flag

fLogOff = lParam // logoff flag

Parameters

fEndSession

Value of wParam. Specifies whether the session is being ended. If the session is being ended, this parameter is TRUE; otherwise, it is FALSE.

fLogOff

Value of lParam. Indicates whether the user is logging off or shutting down the system. Supported values include: ENDSESSION_LOGOFF.

Return Values

If an application processes this message, it should return zero.

Remarks

If the fEndSession parameter is TRUE, the Windows session can end any time after all applications have returned from processing this message. Therefore, an application should perform all tasks required for termination before returning from this message.

The application need not call the DestroyWindow or PostQuitMessage function when the session is ending.

See Also

DestroyWindow, PostQuitMessage , WM_QUERYENDSESSION


 WM_ENTERIDLE

The WM_ENTERIDLE message is sent to the owner window of a modal dialog box or menu that is entering an idle state. A modal dialog box or menu enters an idle state when no messages are waiting in its queue after it has processed one or more previous messages.

WM_ENTERIDLE

fuSource = wParam; // idle-source flag

hwnd = (HWND) lParam; // handle of dialog box or owner window

Parameters

fuSource

Value of wParam. Specifies whether the message is the result of a dialog box or a menu being displayed. This parameter can be one of the following values:

Value | Meaning
MSGF_DIALOGBOX | The system is idle because a dialog box is displayed.
MSGF_MENU | The system is idle because a menu is displayed.

hwnd

Value of lParam. Contains the handle of the dialog box (if fuSource is MSGF_DIALOGBOX) or of the window containing the displayed menu (if fuSource is MSGF_MENU).

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function returns zero.

See Also

DefWindowProc


 WM_ENTERMENULOOP

The WM_ENTERMENULOOP message informs an application's main window procedure that a menu modal loop has been entered.

WM_ENTERMENULOOP

wParam = (BOOL) fIsTrackPopupMenu // flags a shortcut menu

lParam = 0 ; // not used; must be zero

Parameters

fIsTrackPopupMenu

Specifies whether the menu involved is a shortcut menu. This parameter has a value of TRUE if it is a shortcut menu, FALSE if it isn't.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function returns zero.

See Also

DefWindowProc, WM_EXITMENULOOP


 WM_ENTERSIZEMOVE

The WM_ENTERSIZEMOVE message is sent once to a window when it enters the moving or sizing mode. The window enters the moving or sizing mode when the user clicks the window's title bar or sizing border, or when the window passes the WM_SYSCOMMAND message to the DefWindowProc function and the wParam parameter of the message specifies the SC_MOVE or SC_SIZE value. Windows sends the WM_ENTERSIZEMOVE message regardless of whether the dragging of full windows is enabled.

WM_ENTERSIZEMOVE

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

See Also

DefWindowProc, WM_EXITSIZEMOVE, WM_SYSCOMMAND


 WM_ERASEBKGND

An application sends the WM_ERASEBKGND message when the window background must be erased (for example, when a window is resized). The message is sent to prepare an invalidated portion of a window for painting.

WM_ERASEBKGND

hdc = (HDC) wParam; // handle of device context

Parameters

hdc

Value of wParam. Identifies the device context.

Return Values

An application should return nonzero if it erases the background; otherwise, it should return zero.

Remarks

The DefWindowProc function erases the background by using the class background brush specified by the hbrBackground member of the WNDCLASS structure. If hbrBackground is NULL, the application should process the WM_ERASEBKGND message and erase the background.

An application should return nonzero in response to WM_ERASEBKGND if it processes the message and erases the background; this indicates that no further erasing is required. If the application returns zero, the window will remain marked for erasing. (Typically, this indicates that the fErase member of the PAINTSTRUCT structure will be TRUE.)

See Also

BeginPaint, DefWindowProc , PAINTSTRUCT , WM_ICONERASEBKGND, WNDCLASS


 WM_EXITMENULOOP

The WM_EXITMENULOOP message informs an application's main window procedure that a menu modal loop has been exited.

WM_EXITLOOP

wParam = (BOOL) fIsTrackPopupMenu // flags a shortcut menu

lParam = 0 ; // not used; must be zero

Parameters

fIsTrackPopupMenu

Specifies whether the menu involved is a shortcut menu. This parameter has a value of TRUE if it is a shortcut menu, FALSE if it isn't.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function returns zero.

See Also

DefWindowProc, WM_ENTERMENULOOP


 WM_EXITSIZEMOVE

The WM_EXITSIZEMOVE message is sent once to a window after it has exited the moving or sizing mode.

WM_EXITSIZEMOVE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

See Also

WM_ENTERSIZEMOVE


 WM_FONTCHANGE

An application sends the WM_FONTCHANGE message to all top-level windows in the system after changing the pool of font resources.

WM_FONTCHANGE

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Remarks

An application that adds or removes fonts from the system (for example, by using the AddFontResource or RemoveFontResource function) should send this message to all top-level windows.

To send the WM_FONTCHANGE message to all top-level windows, an application can call the SendMessage function with the hwnd parameter set to HWND_BROADCAST.

See Also

AddFontResource, RemoveFontResource , SendMessage


 WM_GETDLGCODE

The WM_GETDLGCODE message is sent to the dialog box procedure associated with a control. Normally, Windows handles all arrow-key and TAB-key input to the control. By responding to the WM_GETDLGCODE message, an application can take control of a particular type of input and process the input itself.

WM_GETDLGCODE

Parameters

This message has no parameters.

Return Values

The return value is one or more of the following values, indicating which type of input the application processes.

Value | Meaning
DLGC_BUTTON | Button.
DLGC_DEFPUSHBUTTON | Default push button.
DLGC_HASSETSEL | EM_SETSEL messages.
DLGC_RADIOBUTTON | Radio button.
DLGC_STATIC | Static control.
DLGC_UNDEFPUSHBUTTON | Nondefault push button.
DLGC_WANTALLKEYS | All keyboard input.
DLGC_WANTARROWS | Direction keys.
DLGC_WANTCHARS | WM_CHAR messages.
DLGC_WANTMESSAGE | All keyboard input (the application passes this message on to a control).
DLGC_WANTTAB | TAB key.

Default Action

The DefWindowProc function returns zero.

Remarks

Although the DefWindowProc function always returns zero in response to the WM_GETDLGCODE message, the window procedure for the predefined control classes return a code appropriate for each class.

The WM_GETDLGCODE message and the returned values are useful only with user-defined dialog box controls or standard controls modified by subclassing.

See Also

DefWindowProc, EM_SETSEL, WM_CHAR


 WM_GETFONT

An application sends a WM_GETFONT message to a control to retrieve the font with which the control is currently drawing its text.

WM_GETFONT

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

The return value is the handle of the font used by the control, or NULL if the control is using the system font.

See Also

WM_SETFONT


 WM_GETHOTKEY

An application sends a WM_GETHOTKEY message to determine the hot key associated with a window.

WM_GETHOTKEY

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the virtual-key code and modifiers for the hot key, or NULL if no hot key is associated with the window. The virtual-key code is in the low byte of the return value and the modifiers are in the high byte. The modifiers can be a combination of the following flags:

Value | Meaning
HOTKEYF_ALT | ALT key
HOTKEYF_CONTROL | CTRL key
HOTKEYF_EXT | Extended key
HOTKEYF_SHIFT | SHIFT key

Remarks

These hot keys are unrelated to the hot keys set by the RegisterHotKey function.

See Also

RegisterHotKey, WM_SETHOTKEY


 WM_GETICON

The WM_GETICON message is sent to a window to retrieve the handle of the large or small icon associated with a window. Windows retrieves the large icon when drawing a minimized window, and the small icon when drawing a title bar.

WM_GETICON

fType = wParam; // icon type

Parameters

fType

Value of wParam. Specifies the type of icon being retrieved. This parameter can be one of the following values:

Value | Meaning
ICON_BIG | Retrieve the large icon for the window.
ICON_SMALL | Retrieve the small icon for the window.

Return Values

The return value is the handle of the large or small icon, depending on the value of fType. When an application receives this message, it can return the handle of a large or small icon, or pass the message to DefWindowProc.

Default Action

DefWindowProc returns the handle of the large or small icon associated with the window, depending on the value of fType.

Remarks

When an application receives this message, it can return the handle of a large or small icon, or pass the message to DefWindowProc.

See Also

DefWindowProc, WM_SETICON


 WM_GETMINMAXINFO

The WM_GETMINMAXINFO message is sent to a window when the size or position of the window is about to change. An application can use this message to override the window's default maximized size and position, or its default minimum or maximum tracking size.

WM_GETMINMAXINFO

lpmmi = (LPMINMAXINFO) lParam; // address of structure

Parameters

lpmmi

Value of lParam. Points to a MINMAXINFO structure that contains the default maximized position and dimensions, and the default minimum and maximum tracking sizes. An application can override the defaults by setting the members of this structure.

Return Values

If an application processes this message, it should return zero.

Remarks

The maximum tracking size is the largest window size that can be produced by using the borders to size the window. The minimum tracking size is the smallest window size that can be produced by using the borders to size the window.

See Also

MoveWindow, SetWindowPos , MINMAXINFO


 WM_GETTEXT

An application sends a WM_GETTEXT message to copy the text that corresponds to a window into a buffer provided by the caller.

WM_GETTEXT

wParam = (WPARAM) cchTextMax; // number of characters to copy

lParam = (LPARAM) lpszText; // address of buffer for text

Parameters

cchTextMax

Value of wParam. Specifies the maximum number of characters to be copied, including the terminating null character.

lpszText

Value of lParam. Points to the buffer that is to receive the text.

Return Values

The return value is the number of characters copied.

Default Action

The DefWindowProc function copies the text associated with the window into the specified buffer and returns the number of characters copied.

Remarks

For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To copy the text of an item in a list box, an application can use the LB_GETTEXT message.

When the WM_GETTEXT message is sent to a static control with the SS_ICON style, the handle of the icon will be returned in the first four bytes of the buffer pointed to by lpszText. This is true only if the WM_SETTEXT message has been used to set the icon.

In a rich edit control, if the text to be copied exceeds 64K, use either the message EM_STREAMOUT or EM_GETSELTEXT.

See Also

DefWindowProc, EM_GETSELTEXT, EM_STREAMOUT, GetWindowText , GetWindowTextLength , LB_GETTEXT, WM_GETTEXTLENGTH, WM_SETTEXT


 WM_GETTEXTLENGTH

An application sends a WM_GETTEXTLENGTH message to determine the length, in characters, of the text associated with a window. The length does not include the terminating null character.

WM_GETTEXTLENGTH

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

The return value is the length, in characters, of the text.

Default Action

The DefWindowProc function returns the length, in characters, of the text. Under certain conditions, this value may actually be greater than the length of the text. For more information, see the following Remarks section.

Remarks

For an edit control, the text to be copied is the content of the edit control. For a combo box, the text is the content of the edit control (or static-text) portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. To determine the length of an item in a list box, an application can use the LB_GETTEXTLEN message.

Under certain conditions, the DefWindowProc function returns a value that is larger than the actual length of the text. This occurs with certain mixtures of ANSI and Unicode, and is due to the operating system allowing for the possible existence of DBCS characters within the text. The return value, however, will always be at least as large as the actual length of the text; you can thus always use it to guide buffer allocation. This behavior can occur when an application uses both ANSI functions and common dialogs, which use Unicode.

To obtain the exact length of the text, use the WM_GETTEXT, LB_GETTEXT, or CB_GETLBTEXT messages, or the GetWindowText function.

See Also

CB_GETLBTEXT, DefWindowProc , GetWindowText , GetWindowTextLength , LB_GETTEXT, LB_GETTEXTLEN, WM_GETTEXT


 WM_HELP

The WM_HELP message indicates that the user pressed the F1 key. If a menu is active when F1 is pressed, WM_HELP is sent to the window associated with the menu; otherwise, WM_HELP is sent to the window that has the keyboard focus. If no Window has the keyboard focus, WM_HELP is sent to the currently active window.

WM_HELP

lphi = (LPHELPINFO) lParam;

Parameters

lphi

Pointer to a HELPINFO structure that contains information about the menu item, control, dialog box, or window for which help is requested.

Return Values

Returns TRUE.

Remarks

The DefWindowProc function passes WM_HELP to the parent window of a child window or to the owner of a top-level window.

See Also

DefWindowProc, HELPINFO


 WM_HOTKEY

The WM_HOTKEY message is posted when the user presses a hot key registered by the RegisterHotKey function. The message is placed at the top of the message queue associated with the thread that registered the hot key.

WM_HOTKEY

idHotKey = (int) wParam; // identifier of hot key

fuModifiers = (UINT) LOWORD(lParam); // key-modifier flags

uVirtKey = (UINT) HIWORD(lParam); // virtual-key code

Parameters

idHotKey

Value of wParam. Specifies the identifier of the hot key that generated the message. If the message was generated by a system-defined hot key, the idHotKey parameter will be one of the following values:

Value | Meaning
IDHOT_SNAPDESKTOP | The "snap desktop" hot key was pressed.
IDHOT_SNAPWINDOW | The "snap window" hot key was pressed.

fuModifiers

Specifies the keys that were to be pressed in combination with the key specified by the nVirtKey parameter to generate the WM_HOTKEY message. The fuModifiers parameter can be a combination of the following values:

Value | Meaning
MOD_ALT | Either ALT key was held down.
MOD_CONTROL | Either CTRL key was held down.
MOD_SHIFT | Either SHIFT key was held down.
MOD_WIN | Either WINDOWS key was held down. These keys appear only on the Microsoft Ergonomic Keyboard and are labeled with the Microsoft Windows logo.

uVirtKey

Specifies the virtual key code of the hot key.

Remarks

WM_HOTKEY is unrelated to the WM_GETHOTKEY and WM_SETHOTKEY hot keys. The WM_HOTKEY message is sent for generic hot keys while the WM_SET\GETHOTKEY messages relate to window activation hot keys.

See Also

RegisterHotKey, WM_GETHOTKEY, WM_SETHOTKEY


 WM_HSCROLL

The WM_HSCROLL message is sent to a window when a scroll event occurs in the window's standard horizontal scroll bar. This message is also sent to the owner of a horizontal scroll bar control when a scroll event occurs in the control.

WM_HSCROLL

nScrollCode = (int) LOWORD(wParam); // scroll bar value

nPos = (short int) HIWORD(wParam); // scroll box position

hwndScrollBar = (HWND) lParam; // handle of scroll bar

Parameters

nScrollCode

Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values:

Value | Meaning
SB_BOTTOM | Scrolls to the lower right.
SB_ENDSCROLL | Ends scroll.
SB_LINELEFT | Scrolls left by one unit.
SB_LINERIGHT | Scrolls right by one unit.
SB_PAGELEFT | Scrolls left by the width of the window.
SB_PAGERIGHT | Scrolls right by the width of the window.
SB_THUMBPOSITION | Scrolls to the absolute position. The current position is specified by the nPos parameter.
SB_THUMBTRACK | Drags scroll box to the specified position. The current position is specified by the nPos parameter.
SB_TOP | Scrolls to the upper left.

nPos

Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used.

hwndScrollBar

Value of lParam. Identifies the control if WM_HSCROLL is sent by a scroll bar control. If WM_HSCROLL is sent by a window's standard scroll bar, hwndScrollBar is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

The SB_THUMBTRACK notification message is typically used by applications that provide feedback as the user drags the scroll box.

If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function.

Note that the WM_HSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_HSCROLL (and WM_VSCROLL) for scroll position data have a practical maximum position value of 65,535.

However, because the SetScrollPos, SetScrollRange, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollPos for a description of the technique and its limits.

See Also

GetScrollPos, GetScrollRange , SetScrollPos , SetScrollRange , WM_VSCROLL


 WM_HSCROLLCLIPBOARD

The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values.

WM_HSCROLLCLIPBOARD

hwndViewer = (HWND) wParam; // handle of clipboard viewer window

nScrollCode = (int) LOWORD(lParam); // scroll bar code

nPos = (int) HIWORD(lParam); // scroll box position

Parameters

hwndViewer

Value of wParam. Identifies the clipboard viewer window.

nScrollCode

Value of the low-order word of lParam. Specifies a scroll bar event. This parameter can be one of the following values:

Value | Meaning
SB_BOTTOM | Scroll to lower right.
SB_ENDSCROLL | End scroll.
SB_LINEDOWN | Scroll one line down.
SB_LINEUP | Scroll one line up.
SB_PAGEDOWN | Scroll one page down.
SB_PAGEUP | Scroll one page up.
SB_THUMBPOSITION | Scroll to absolute position. The current position is specified by the nPos parameter.
SB_TOP | Scroll to upper left.

nPos

Value of the high-order word of lParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION; otherwise, the nPos parameter is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

The clipboard owner can use the ScrollWindow function to scroll the image in the clipboard viewer window and invalidate the appropriate region.

See Also

ScrollWindow


 WM_ICONERASEBKGND

The WM_ICONERASEBKGND message is sent to a minimized window when the background of the icon must be filled before painting the icon. A window receives this message only if a class icon is defined for the window; otherwise, WM_ERASEBKGND is sent.

WM_ICONERASEBKGND

hdc = (HDC) wParam; // handle of device context

Parameters

hdc

Value of wParam. Identifies the device context of the icon.

Return Values

An application should return nonzero if it processes this message.

Remarks

The DefWindowProc function fills the icon background with the class background brush of the parent window.

See Also

DefWindowProc, WM_ERASEBKGND


 WM_IME_CHAR

The WM_IME_CHAR message is sent to an application when the IME gets a character of the conversion result. Unlike the WM_CHAR message, this message can include double-byte as well as single-byte character values.

chCharCode1 = (TCHAR) wParam;
chCharCode2 = (TCHAR) wParam>>8;
lKeyData = lParam;

Parameters

chCharCode1 and chCharCode2

Single- or double-byte character value.

lKeyData

Repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown following:

Bit | Meaning
0 - 15 | Repeat count: Since the first byte and second byte is continuous, this is always 1.
16 - 23 | Scan Code: Scan code for complete a FE character.
24 - 28 | Not used.
29 | Context code.
31 | Conversion state.

Remarks

If the WM_IME_CHAR message includes a double-byte character, the DefWindowProc function converts this message into two WM_CHAR messages, each containing one byte of the double-byte character.

See Also

DefWindowProc, WM_CHAR


 WM_IME_COMPOSITION

The WM_IME_COMPOSITION message is sent to an application when the IME changes composition status as a result of a key stroke. An application should process this message if it displays composition characters itself. Otherwise, it should send the message to the IME window.

chDBCS = (WORD) wParam;
fFlags = (BOOL) lParam;

Parameters

chDBCS

DBCS character representing the latest change to the composition string.

fFlags

Change flag, indicating how the composition string or character changed. This parameter can be one or more of the following values:

GCS_COMPSTR | GCS_SETCURSORPOS
GCS_COMPATTR | GCS_RESULTSTR
GCS_COMPCLAUSE | GCS_RESULTCLAUSE
GCS_COMPREADSTR | GCS_RESULTREADSTR
GCS_COMPREADATTR | GCS_RESULTREADCLAUSE
GCS_COMPREADCLAUSE | GCR_ERRORSTR
GCS_TYPINGINFO | GCR_INFOSTR

Return Values

No return value.

Remarks

For more information about these values, see the "IME Composition String Values" table in Input Method Editor Constants.

The fFlags parameter can also be a combination of the following values:

Value | Meaning
CS_INSERTCHAR | Specifies that the given composition character should be inserted at the current insertion point. An application should display the composition character if it processes this message.
CS_NOMOVECARET | Specifies that the application must not move the caret position as a result of processing the message. For example, if an IME specifies a combination of CS_INSERTCHAR and CS_NOMOVECARET, the application should insert the given character at the current caret position but should not move caret to the next position. A subsequent WM_IME_COMPOSITION message with GCS_RESULTSTR will replace this character.

If the application has created an IME window, it should pass this message to that window. The DefWindowProc function processes this message by passing it to the default IME window.The IME window processes this message by updating its appearance based on the change flag given. An application can call ImmGetCompositionString to retrieve the new composition status.

If none of the GCS_ values are set, the message indicates that the current composition has been canceled and applications that draw the composition string should delete the string.

See Also

DefWindowProc, ImmGetCompositionString


 WM_IME_COMPOSITIONFULL

The WM_IME_COMPOSITIONFULL message is sent to an application when the IME window finds no space to extend the area for the composition window. The application should use the IMC_SETCOMPOSITIONWINDOW message to specify how to display the window.

Return Values

No return value.

Remarks

The wParam and lParam parameters are not used. The IME window, not the IME, sends this notification message by using the SendMessage message.

See Also

IMC_SETCOMPOSITIONWINDOW, SendMessage


 WM_IME_CONTROL

The WM_IME_CONTROL message directs the IME window to carry out the requested command. An application uses this message to control the IME window created by the application.

wParam = (WPARAM) (DWORD) dwCommand;
lParam = (LPARAM) (DWORD) dwData;

Parameters

dwCommand

Command value. This parameter can be one of the following values:

IMC_GETCANDIDATEPOS | IMC_OPENSTATUSWINDOW
IMC_GETCOMPOSITIONFONT | IMC_SETCANDIDATEPOS
IMC_GETCOMPOSITIONWINDOW | IMC_SETCOMPOSITIONFONT
IMC_GETCONVERSIONMODE | IMC_SETCOMPOSITIONWINDOW
IMC_GETOPENSTATUS | IMC_SETCONVERSIONMODE
IMC_GETSENTENCEMODE | IMC_SETOPENSTATUS
IMC_GETSTATUSWINDOWPOS | IMC_SETSENTENCEMODE
IMC_CLOSESTATUSWINDOW | IMC_SETSTATUSWINDOWPOS

For more information about these commands, see the individual descriptions.

dwData

Command-specific value.

Return Values

Returns a command-specific value.

See Also

IMC_CLOSESTATUSWINDOW, IMC_GETCANDIDATEPOS, IMC_GETCOMPOSITIONFONT, IMC_GETCOMPOSITIONWINDOW, IMC_GETCONVERSIONMODE, IMC_GETOPENSTATUS, IMC_GETSENTENCEMODE, IMC_GETSTATUSWINDOWPOS, IMC_OPENSTATUSWINDOW, IMC_SETCANDIDATEPOS, IMC_SETCOMPOSITIONFONT, IMC_SETCOMPOSITIONWINDOW, IMC_SETCONVERSIONMODE, IMC_SETOPENSTATUS, IMC_SETSENTENCEMODE, IMC_SETSTATUSWINDOWPOS


 WM_IME_ENDCOMPOSITION

The WM_IME_ENDCOMPOSITION message is sent to an application when the IME ends composition. An application should process this message if it displays composition characters itself.

Return Values

No return value.

Remarks

The wParam and lParam parameters are not used.

If an application has created an IME window, it should pass this message to that window. The DefWindowProc function processes this message by passing it to default IME window.

See Also

DefWindowProc


 WM_IME_KEYDOWN

The WM_IME_KEYDOWN message is sent to an application by the IME to notify the application of a key press. The parameters and return value for this message are identical to the WM_KEYDOWN message. An application can process this message or pass it to the DefWindowProc function to generate a matching WM_KEYDOWN message. This message is usually generated by the IME to keep message order.

nVirtKey = (int) wParam; // virtual-key code
lKeyData = lParam; // key data

See Also

DefWindowProc


 WM_IME_KEYUP

The WM_IME_KEYUP message is sent to an application by the IME to notify the application of a key release. The parameters and return value for this message are identical to the WM_KEYUP message. An application can process this message or pass it to the DefWindowProc function to generate a matching WM_KEYUP message. This message is usually generated by the IME to keep message order.

nVirtKey = (int) wParam; // virtual-key code
lKeyData = lParam; // key data

See Also

DefWindowProc


 WM_IME_NOTIFY

The WM_IME_NOTIFY message is sent to an application to notify it of changes to the IME window. An application processes this message if it is responsible for managing the IME window.

dwCommand = (DWORD) wParam;
dwData = (DWORD) lParam;

Parameters

dwCommand

Command value. This parameter may be one of the following values:

IMN_CHANGECANDIDATE | IMN_SETCANDIDATEPOS
IMN_CLOSECANDIDATE | IMN_SETCOMPOSITIONFONT
IMN_CLOSESTATUSWINDOW | IMN_SETCOMPOSITIONWINDOW
IMN_GUIDELINE | IMN_SETCONVERSIONMODE
IMN_OPENCANDIDATE | IMN_SETOPENSTATUS
IMN_OPENSTATUSWINDOW | IMN_SETSENTENCEMODE
IMN_PRIVATE | IMN_SETSTATUSWINDOWPOS

For more information about these commands, see the corresponding descriptions.

dwData

Command-specific value.

Return Values

Returns a command-specific value.

IMN_CHANGECANDIDATE, IMN_OPENCANDIDATE, IMN_OPENSTATUSWINDOW, IMN_SETCANDIDATEPOS, IMN_SETCOMPOSITIONFONT, IMN_SETCOMPOSITIONWINDOW, IMN_SETCONVERSIONMODE, IMN_SETOPENSTATUS, IMN_SETSENTENCEMODE, IMN_SETSTATUSWINDOWPOS


 WM_IME_SELECT

The WM_IME_SELECT message is sent to an application when the system is about to change the current IME. An application that has created an IME window should pass this message to that window so that it can retrieve the keyboard layout handle for the newly selected IME.

fSeleft = (BOOL) wParam;
hKL = (HANDLE) lParam;

Parameters

fSelect

Selection flag. If TRUE, the specified IME is selected; if FALSE, the specified IME is no longer selected.

hKL

Handle to the keyboard layout associated with the IME.

Return Values

No return value.

Remarks

The DefWindowProc function processes this message by passing the information to the default IME window.

See Also

DefWindowProc


 WM_IME_SETCONTEXT

The WM_IME_SETCONTEXT message is sent to an application when a window of the application is activated. If the application has created an IME window, it should call the ImmIsUIMessage function. Otherwise, it should pass this message to the DefWindowProc function.

fSet = (BOOL) wParam;
iShow = (DWORD) lParam;

Parameters

fSet

Active flag. If TRUE, the input context is active. If FALSE, the context is inactive.

iShow

Show flags. Can be a combination of the following values:

Value | Description
ISC_SHOWUICOMPOSITIONWINDOW | Shows the composition window by UI window.
ISC_SHOWUIGUIDWINDOW | Shows the guide window by UI window
ISC_SHOWUISOFTKBD | Shows the soft keyboard by UI window
ISC_SHOWUICANDIDATEWINDOW | Shows the candidate window of Index 0 by UI window.
ISC_SHOWUICANDIDATEWINDOW << 1 | Shows the candidate window of Index 1 by UI window.
ISC_SHOWUICANDIDATEWINDOW << 2 | Shows the candidate window of Index 2 by UI window.
ISC_SHOWUICANDIDATEWINDOW << 3 | Shows the candidate window of Index 3 by UI window.

If the application draws the composition window, the default IME window does not need to show its composition window. In this case, the application must clear the ISC_SHOWUICOMPOSITIONWINDOW value from the lParam parameter before passing the message to the DefWindowProc or ImmIsUIMessage functions.

Return Values

Returns the value returned by DefWindowProc or ImmIsUIMessage.

See Also

DefWindowProc, ImmIsUIMessage


 WM_IME_STARTCOMPOSITION

The WM_IME_STARTCOMPOSITION message is sent immediately before the IME generates composition string as a result of a key stroke. The message is a notification to an IME window to open its composition window. An application should process this message if it displays composition characters itself.

Return Values

No return value.

Remarks

The wParam and lParam parameters are not used.

If an application has created an IME window, it should pass the WM_IME_STARTCOMPOSITION message to that window. The DefWindowProc function processes this message by passing it to the default IME window.

See Also

DefWindowProc


 WM_INITDIALOG

The WM_INITDIALOG message is sent to the dialog box procedure immediately before a dialog box is displayed. Dialog box procedures typically use this message to initialize controls and carry out any other initialization tasks that affect the appearance of the dialog box.

WM_INITDIALOG

hwndFocus = (HWND) wParam; // handle of control to receive focus

lInitParam = lParam; // initialization parameter

Parameters

hwndFocus

Value of wParam. Identifies the control to receive the default keyboard focus. Windows assigns the default keyboard focus only if the dialog box procedure returns TRUE.

lInitParam

Value of lParam. Specifies additional initialization data. This data is passed to Windows as the lParamInit parameter in a call to the CreateDialogIndirectParam , CreateDialogParam , DialogBoxIndirectParam , or DialogBoxParam function used to create the dialog box. This parameter is zero if any other dialog box creation function is used.

Return Values

The dialog box procedure should return TRUE to direct Windows to set the keyboard focus to the control given by hwndFocus. Otherwise, it should return FALSE to prevent Windows from setting the default keyboard focus.

Remarks

The control to receive the default keyboard focus is always the first control in the dialog box that is visible, not disabled, and that has the WS_TABSTOP style. When the dialog box procedure returns TRUE, Windows checks the control to ensure that the procedure has not disabled it. If it has been disabled, Windows sets the keyboard focus to the next control that is visible, not disabled, and has the WS_TABSTOP.

An application can return FALSE only if it has set the keyboard focus to one of the controls of the dialog box.

See Also

CreateDialogIndirectParam, CreateDialogParam , DialogBoxIndirectParam , DialogBoxParam , SetFocus


 WM_INITMENU

The WM_INITMENU message is sent when a menu is about to become active. It occurs when the user clicks an item on the menu bar or presses a menu key. This allows the application to modify the menu before it is displayed.

WM_INITMENU

hmenuInit = (HMENU) wParam; // handle of menu to initialize

Parameters

hmenuInit

Value of wParam. Identifies the menu to be initialized.

Return Values

If an application processes this message, it should return zero.

Remarks

A WM_INITMENU message is sent only when a menu is first accessed; only one WM_INITMENU message is generated for each access. For example, moving the mouse across several menu items while holding down the button does not generate new messages. WM_INITMENU does not provide information about menu items.

See Also

WM_INITMENUPOPUP


 WM_INITMENUPOPUP

The WM_INITMENUPOPUP message is sent when a drop-down menu or submenu is about to become active. This allows an application to modify the menu before it is displayed, without changing the entire menu.

WM_INITMENUPOPUP

hmenuPopup = (HMENU) wParam; // handle of submenu

uPos = (UINT) LOWORD(lParam); // submenu item position

fSystemMenu = (BOOL) HIWORD(lParam); // window menu flag

Parameters

hmenuPopup

Value of wParam. Identifies the drop-down menu or submenu.

uPos

Value of the low-order word of lParam. Specifies the zero-based relative position of the menu item that opens the drop-down menu or submenu.

fSystemMenu

Value of the high-order word of lParam. Specifies whether the drop-down menu is the window menu (also known as the System menu or the Control menu). If the menu is the window menu, this parameter is TRUE; otherwise, it is FALSE.

Return Values

If an application processes this message, it should return zero.

See Also

WM_INITMENU


 WM_INPUTLANGCHANGE

The WM_INPUTLANGCHANGE message is sent to the topmost affected window after a task's locale has been changed. It should be used to make any application-specific settings and passed on to the DefWindowProc function to be passed on to any children.

WM_INPUTLANGCHANGE
charset = wParam;
hkl = (HKL) lParam;

Parameters

charset

Value of wParam. Specifies the character set of the new keyboard layout.

hkl

Value of lParam. Identifies the new keyboard layout.

Return Values

An application should return nonzero if it processes this message.

See Also

DefWindowProc, WM_INPUTLANGCHANGEREQUEST


 WM_INPUTLANGCHANGEREQUEST

The WM_INPUTLANGCHANGEREQUEST message is posted to the application's top-level window when the user chooses an input language, either with an input language change hotkey or from the system languages menu. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately.

WM_INPUTLANGCHANGEREQUEST
fSysCharSet = (BOOL) wParam

hkl = (HKL) lParam;

Parameters

wParam

The lowest bit of this parameter is set if the handle of the keyboard layout can be used with the system character set. The other bits are reserved. For example, in the Russian-language version of Windows 95, this parameter has the low bit set for keyboard layout handles for English (US) and Russian, but cleared for other handles.

hkl

Value of lParam. Identifies the keyboard layout to switch to.

Return Values

This message is posted, not sent, to the application, so the return value is ignored. To accept the change, the application should pass the message on to DefWindowProc. To reject the change, the application should return zero without calling DefWindowProc.

See Also

DefWindowProc, WM_INPUTLANGCHANGE


 WM_KEYDOWN

The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed.

WM_KEYDOWN

nVirtKey = (int) wParam; // virtual-key code

lKeyData = lParam; // key data

Parameters

nVirtKey

Value of wParam. Specifies the virtual-key code of the nonsystem key.

lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value | Description
0 [image] 15 | Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key.
16 [image] 23 | Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 | Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25 [image] 28 | Reserved; do not use.
29 | Specifies the context code. The value is always 0 for a WM_KEYDOWN message.
30 | Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 | Specifies the transition state. The value is always 0 for a WM_KEYDOWN message.

Return Values

An application should return zero if it processes this message.

Default Action

If the F10 key is pressed, the DefWindowProc function sets an internal flag. When DefWindowProc receives the WM_KEYUP message, the function checks whether the internal flag is set and, if so, sends a WM_SYSCOMMAND message to the top-level window. The wParam parameter of the message is set to SC_KEYMENU.

Remarks

Because of the autorepeat feature, more than one WM_KEYDOWN message may be posted before a WM_KEYUP message is posted. The previous key state (bit 30) can be used to determine whether the WM_KEYDOWN message indicates the first down transition or a repeated down transition.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

See Also

DefWindowProc, WM_CHAR, WM_KEYUP, WM_SYSCOMMAND


 WM_KEYUP

The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the keyboard focus.

WM_KEYUP

nVirtKey = (int) wParam; // virtual-key code

lKeyData = lParam; // key data

Parameters

nVirtKey

Value of wParam. Specifies the virtual-key code of the nonsystem key.

lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value | Description
0 [image] 15 | Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key. The repeat count is always one for a WM_KEYUP message.
16 [image] 23 | Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 | Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25 [image] 28 | Reserved; do not use.
29 | Specifies the context code. The value is always 0 for a WM_KEYUP message.
30 | Specifies the previous key state. The value is always 1 for a WM_KEYUP message.
31 | Specifies the transition state. The value is always 1 for a WM_KEYUP message.

Return Values

An application should return zero if it processes this message.

Default Action

The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the F10 key or the ALT key was released. The wParam parameter of the message is set to SC_KEYMENU.

Remarks

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

See Also

DefWindowProc, WM_KEYDOWN, WM_SYSCOMMAND


 WM_KILLFOCUS

The WM_KILLFOCUS message is sent to a window immediately before it loses the keyboard focus.

WM_KILLFOCUS

hwndGetFocus = (HWND) wParam; // handle of window receiving focus

Parameters

hwndGetFocus

Value of wParam. Identifies the window that receives the keyboard focus (may be NULL).

Return Values

An application should return zero if it processes this message.

Remarks

If an application is displaying a caret, the caret should be destroyed at this point.

See Also

SetFocus, WM_SETFOCUS


 WM_LBUTTONDBLCLK

The WM_LBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_LBUTTONDBLCLK

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Only windows that have the CS_DBLCLKS style can receive WM_LBUTTONDBLCLK messages, which Windows generates whenever the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates four messages: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_LBUTTONUP again.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, GetDoubleClickTime , MAKEPOINTS , POINTS , SetCapture , SetDoubleClickTime , WM_LBUTTONDOWN, WM_LBUTTONUP


 WM_LBUTTONDOWN

The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_LBUTTONDOWN

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, MAKEPOINTS , POINTS , SetCapture , WM_LBUTTONDBLCLK, WM_LBUTTONUP


 WM_LBUTTONUP

The WM_LBUTTONUP message is posted when the user releases the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_LBUTTONUP

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, MAKEPOINTS , POINTS , SetCapture , WM_LBUTTONDBLCLK, WM_LBUTTONDOWN


 WM_MBUTTONDBLCLK

The WM_MBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_MBUTTONDBLCLK

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Only windows that have the CS_DBLCLKS style can receive WM_MBUTTONDBLCLK messages, which Windows generates whenever the user presses, releases, and again presses the middle mouse button within the system's double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MBUTTONDBLCLK, and WM_MBUTTONUP again.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, GetDoubleClickTime , MAKEPOINTS , POINTS , SetCapture , SetDoubleClickTime , WM_MBUTTONDOWN, WM_MBUTTONUP


 WM_MBUTTONDOWN

The WM_MBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_MBUTTONDOWN

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, MAKEPOINTS , POINTS , SetCapture , WM_MBUTTONDBLCLK, WM_MBUTTONUP


 WM_MBUTTONUP

The WM_MBUTTONUP message is posted when the user releases the middle mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_MBUTTONUP

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, MAKEPOINTS , POINTS , SetCapture , WM_MBUTTONDBLCLK, WM_MBUTTONDOWN


 WM_MDIACTIVATE

An application sends the WM_MDIACTIVATE message to a multiple document interface (MDI) client window to instruct the client window to activate a different MDI child window. As the client window processes this message, it sends WM_MDIACTIVATE to the child window being deactivated and to the child window being activated.

WM_MDIACTIVATE

// Message sent to MDI client

wParam = (WPARAM) (HWND) hwndChildAct; // child to activate

lParam = 0; // not used; must be zero

// Message received by MDI child

hwndChildDeact = (HWND) wParam; // child being deactivated

hwndChildAct = (HWND) lParam; // child being activated

Parameters

In messages sent to an MDI client window:

hwndChildAct

Value of wParam. Identifies the MDI child window to be activated.

In messages received by an MDI child window:

hwndChildDeact

Value of wParam. Identifies the MDI child window being deactivated.

hwndChildAct

Value of lParam. Identifies the MDI child window being activated.

Return Values

If an application sends this message to an MDI client window, the return value is zero. An MDI child window should return zero if it processes this message.

Remarks

An MDI child window is activated independently of the MDI frame window. When the frame window becomes active, the child window last activated by using the WM_MDIACTIVATE message receives the WM_NCACTIVATE message to draw an active window frame and title bar; the child window does not receive another WM_MDIACTIVATE message.

See Also

WM_MDIGETACTIVE, WM_MDINEXT, WM_NCACTIVATE


 WM_MDICASCADE

An application sends the WM_MDICASCADE message to a multiple document interface (MDI) client window to arrange all its child windows in a cascade format.

WM_MDICASCADE

wParam = (WPARAM) (UINT) fuCascade; // cascade flag

lParam = 0; // not used; must be zero

Parameters

fuCascade

Value of wParam. Specifies a cascade flag. The only flag currently available, MDITILE_SKIPDISABLED, prevents disabled MDI child windows from being cascaded.

Return Values

If the message succeeds, the return value is TRUE.

If the message fails, the return value is FALSE.

See Also

WM_MDIICONARRANGE, WM_MDITILE


 WM_MDICREATE

An application sends the WM_MDICREATE message to a multiple document interface (MDI) client window to create an MDI child window.

WM_MDICREATE

wParam = 0; // not used; must be zero

lParam = (LPARAM) (LPMDICREATESTRUCT) lpmdic; // creation data

Parameters

lpmdic

Points to an MDICREATESTRUCT structure containing information that Windows uses to create the MDI child window.

Return Values

If the message succeeds, the return value is the handle of the new child window.

If the message fails, the return value is NULL.

Remarks

The MDI child window is created with the style bits WS_CHILD, WS_CLIPSIBLINGS, WS_CLIPCHILDREN, WS_SYSMENU, WS_CAPTION, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX, plus additional style bits specified in the MDICREATESTRUCT structure to which the lpmdic parameter points. Windows adds the title of the new child window to the Window menu of the frame window. An application should use this message to create all child windows of the client window.

If an MDI client window receives any message that changes the activation of its child windows while the active child window is maximized, Windows restores the active child window and maximizes the newly activated child window.

When an MDI child window is created, Windows sends the WM_CREATE message to the window. The lParam parameter of the WM_CREATE message contains a pointer to a CREATESTRUCT structure. The lpCreateParams member of this structure contains a pointer to the MDICREATESTRUCT structure passed with the WM_MDICREATE message that created the MDI child window.

An application should not send a second WM_MDICREATE message while a WM_MDICREATE message is still being processed. For example, it should not send a WM_MDICREATE message while an MDI child window is processing its WM_MDICREATE message.

See Also

CreateMDIWindow, CREATESTRUCT , MDICREATESTRUCT , WM_CREATE, WM_MDIDESTROY


 WM_MDIDESTROY

An application sends the WM_MDIDESTROY message to a multiple document interface (MDI) client window to close an MDI child window.

WM_MDIDESTROY

wParam = (WPARAM) (HWND) hwndChild; // handle of child to close

lParam = 0; // not used; must be zero

Parameters

hwndChild

Value of wParam. Identifies the MDI child window to be closed.

Return Values

This message always returns zero.

Remarks

This message removes the title of the MDI child window from the MDI frame window and deactivates the child window. An application should use this message to close all MDI child windows.

If an MDI client window receives a message that changes the activation of its child windows and the active MDI child window is maximized, Windows restores the active child window and maximizes the newly activated child window.

See Also

WM_MDICREATE


 WM_MDIGETACTIVE

An application sends the WM_MDIGETACTIVE message to a multiple document interface (MDI) client window to retrieve the handle of the active MDI child window.

WM_MDIGETACTIVE

wParam = 0; // not used; must be zero

lParam = (LPBOOL) lpfMaximized; // optional pointer to maximized state flag

Parameters

lpfMaximized

Value of lparam. This is an optional pointer to a maximized state flag variable. If lpfMaximized is non-NULL, the BOOL it points to is set to indicate the maximized state of the MDI child window. TRUE indicates that the window is maximized, FALSE indicates that it is not. This is equivalent to the indication supplied by the high-order word of the return value of the WM_MDIGETACTIVE message under Windows version 3.x. If lpfMaximized is NULL, the parameter is ignored.

Return Values

The return value is the handle of the active MDI child window.

Remarks

Note carefully a change in how this message indicates maximization. In Windows version 3.x, the message return value includes a flag indicating whether the MDI child window is maximized. In the Win32 application programming interface (API), the return value does not include this flag. In Win32, the MDI child window's maximized state is indicated by setting a BOOL variable via the optional parameter in lParam, lpfMaximized.


 WM_MDIICONARRANGE

An application sends the WM_MDIICONARRANGE message to a multiple document interface (MDI) client window to arrange all minimized MDI child windows. It does not affect child windows that are not minimized.

WM_MDIICONARRANGE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

See Also

WM_MDICASCADE, WM_MDITILE


 WM_MDIMAXIMIZE

An application sends the WM_MDIMAXIMIZE message to a multiple document interface (MDI) client window to maximize an MDI child window. Windows resizes the child window to make its client area fill the client window. Windows places the child window's window menu icon in the rightmost position of the frame window's menu bar, and places the child window's restore icon in the leftmost position. Windows also appends the title bar text of the child window to that of the frame window.

WM_MDIMAXIMIZE

wParam = (WPARAM) (HWND) hwndMax; // handle of child to maximize

lParam = 0; // not used; must be zero

Parameters

hwndMax

Value of wParam. Identifies the MDI child window to be maximized.

Return Values

The return value is always zero.

Remarks

If an MDI client window receives any message that changes the activation of its child windows while the currently active MDI child window is maximized, Windows restores the active child window and maximizes the newly activated child window.

See Also

WM_MDIRESTORE


 WM_MDINEXT

An application sends the WM_MDINEXT message to a multiple document interface (MDI) client window to activate the next or previous child window.

WM_MDINEXT

wParam = (WPARAM) (HWND) hwndChild; // handle of child

lParam = (LPARAM) fNext; // next or previous child

Parameters

hwndChild

Value of wParam. Identifies the MDI child window. Windows activates the child window that is immediately before or after the given child window, depending on the value of the fNext parameter. If the hwndChild parameter is NULL, Windows activates the child window that is immediately before or after the currently active child window.

fNext

Value of lParam. If this parameter is zero, Windows activates the next MDI child window and places the child window identified by the hwndChild parameter behind all other child windows. If this parameter is nonzero, Windows activates the previous child window, placing it in front of the child window identified by hwndChild.

Return Values

The return value is always zero.

Remarks

If an MDI client window receives any message that changes the activation of its child windows while the active MDI child window is maximized, Windows restores the active child window and maximizes the newly activated child window.

See Also

WM_MDIACTIVATE, WM_MDIGETACTIVE


 WM_MDIREFRESHMENU

An application sends the WM_MDIREFRESHMENU message to a multiple document interface (MDI) client window to refresh the Window menu of the MDI frame window.

WM_MDIREFRESHMENU

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

If the message succeeds, the return value is the handle of the frame window menu.

If the message fails, the return value is NULL.

Remarks

After sending this message, an application must call the DrawMenuBar function to update the menu bar.

See Also

DrawMenuBar, WM_MDISETMENU


 WM_MDIRESTORE

An application sends the WM_MDIRESTORE message to a multiple document interface (MDI) client window to restore an MDI child window from maximized or minimized size.

WM_MDIRESTORE

wParam = (WPARAM) (HWND) hwndRes; // handle of child to restore

lParam = 0; // not used; must be zero

Parameters

hwndRes

Value of wParam. Identifies the MDI child window to be restored.

Return Values

The return value is always zero.

See Also

WM_MDIMAXIMIZE


 WM_MDISETMENU

An application sends the WM_MDISETMENU message to a multiple document interface (MDI) client window to replace the entire menu of an MDI frame window, to replace the Window menu of the frame window, or both.

WM_MDISETMENU

wParam = (WPARAM) (HMENU) hmenuFrame; // handle of frame menu

lParam = (LPARAM) (HMENU) hmenuWindow; // handle of Window menu

Parameters

hmenuFrame

Value of wParam. Identifies the new frame window menu. If this parameter is NULL, the frame window menu is not changed.

hmenuWindow

Value of lParam. Identifies the new Window menu. If this parameter is NULL, the Window menu is not changed.

Return Values

If the message succeeds, the return value is the handle of the old frame window menu.

If the message fails, the return value is zero.

Remarks

After sending this message, an application must call the DrawMenuBar function to update the menu bar.

If this message replaces the Window menu, the MDI child window menu items are removed from the previous Window menu and added to the new Window menu.

If an MDI child window is maximized and this message replaces the MDI frame window menu, the System menu icon and restore icon are removed from the previous frame window menu and added to the new frame window menu.

See Also

DrawMenuBar, WM_MDIREFRESHMENU


 WM_MDITILE

An application sends the WM_MDITILE message to a multiple document interface (MDI) client window to arrange all of its MDI child windows in a tile format.

WM_MDITILE

wParam = (WPARAM) (UINT) fuTile; // tiling flag

lParam = 0; // not used; must be zero

Parameters

fuTile

Specifies a tiling flag. This parameter can be one of the following values:

Value | Meaning
MDITILE_HORIZONTAL | Tiles MDI child windows so that they are wide rather than tall.
MDITILE_SKIPDISABLED | Prevents disabled MDI child windows from being tiled.
MDITILE_VERTICAL | Tiles MDI child windows so that they are tall rather than wide.

Return Values

If the message succeeds, the return value is TRUE.

If the message fails, the return value is FALSE.

See Also

WM_MDICASCADE, WM_MDIICONARRANGE


 WM_MEASUREITEM

The WM_MEASUREITEM message is sent to the owner window of an owner-drawn button, combo box, list box, list view control, or menu item when the control or menu is created.

WM_MEASUREITEM

idCtl = (UINT) wParam; // control identifier

lpmis = (LPMEASUREITEMSTRUCT) lParam; // item-size information

Parameters

idCtl

Value of wParam. Contains the value of the CtlID member of the MEASUREITEMSTRUCT structure pointed to by the lpmis parameter. This value identifies the control that sent the WM_MEASUREITEM message.

If the value is zero, the message was sent by a menu. If the value is nonzero, the message was sent by a combo box or by a list box. If the value is nonzero, and the value of the itemID member of the MEASUREITEMSTRUCT pointed to by lpmis is (UINT) [image] 1, the message was sent by a combo edit field.

lpmis

Value of lParam. Points to a MEASUREITEMSTRUCT structure that contains the dimensions of the owner-drawn control or menu item.

Return Values

If an application processes this message, it should return TRUE.

Remarks

When the owner window receives the WM_MEASUREITEM message, the owner fills in the MEASUREITEMSTRUCT structure pointed to by the lParam parameter of the message and returns; this informs Windows of the dimensions of the control. If a list box or combo box is created with the LBS_OWNERDRAWVARIABLE or CBS_OWNERDRAWVARIABLE style, this message is sent to the owner for each item in the control; otherwise, this message is sent once.

Windows sends the WM_MEASUREITEM message to the owner window of combo boxes and list boxes created with the OWNERDRAWFIXED style before sending the WM_INITDIALOG message. As a result, when the owner receives this message, Windows has not yet determined the height and width of the font used in the control; function calls and calculations requiring these values should occur in the main function of the application or library.

See Also

MEASUREITEMSTRUCT, WM_INITDIALOG


 WM_MENUCHAR

The WM_MENUCHAR message is sent when a menu is active and the user presses a key that does not correspond to any mnemonic or accelerator key. This message is sent to the window that owns the menu.

WM_MENUCHAR

chUser = (char) LOWORD(wParam); // ASCII character

fuFlag = (UINT) HIWORD(wParam); // menu flag

hmenu = (HMENU) lParam; // handle of menu

Parameters

chUser

Value of the low-order word of wParam. Specifies the ASCII character that corresponds to the key the user pressed.

fuFlag

Value of the high-order word of wParam. Specifies the type of the active menu. This parameter can be one of the following values:

Value | Meaning
MF_POPUP | drop-down menu, submenu, or shortcut menu
MF_SYSMENU | window menu (System menu or Control menu)

hmenu

Value of lParam. Identifies the active menu.

Return Values

An application that processes this message should return one of the following values in the high-order word of the return value:

Value
Meaning
0
Informs Windows that it should discard the character the user pressed and create a short beep on the system speaker.

Informs Windows that it should close the active menu.

Informs Windows that the low-order word of the return value specifies the zero-based relative position of a menu item. This item is selected by Windows.

Remarks

The low-order word is ignored if the high-order word contains 0 or 1. An application should process this message when an accelerator is used to select a menu item that displays a bitmap.


 WM_MENUSELECT

The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item.

WM_MENUSELECT

uItem = (UINT) LOWORD(wParam); // menu item or submenu index

fuFlags = (UINT) HIWORD(wParam); // menu flags

hmenu = (HMENU) lParam; // handle of menu clicked

Parameters

uItem

Value of the low-order word of wParam. If the selected item is a command item, this parameter contains the identifier of the menu item. If the selected item opens a drop-down menu or submenu, this parameter contains the menu index of the drop-down menu or submenu in the main menu, and the hMenu parameter then contains the handle of the main (clicked) menu; use the GetSubMenu function to get the menu handle of the drop-down menu or submenu.

fuFlags

Value of the high-order word of wParam. Specifies one or more menu flags. This parameter can be a combination of the following values:

Value | Description
MF_BITMAP | Item displays a bitmap.
MF_CHECKED | Item is checked.
MF_DISABLED | Item is disabled.
MF_GRAYED | Item is grayed.
MF_HILITE | Item is highlighted.
MF_MOUSESELECT | Item is selected with the mouse.
MF_OWNERDRAW | Item is an owner-drawn item.
MF_POPUP | Item opens a drop-down menu or submenu.
MF_SYSMENU | Item is contained in the window menu (also known as the System menu or Control menu). The hmenu parameter identifies the window menu associated with the message.

hmenu

Value of lParam. Identifies the menu that was clicked.

Return Values

If an application processes this message, it should return zero.

Remarks

If the fuFlags parameter contains 0xFFFF and the hmenu parameter contains NULL, Windows has closed the menu.

Do not use the value [image] 1 for fuFlags. That is because fuFlags is specified as (UINT) HIWORD(wParam). If HIWORD(wParam) were 0xFFFF, fuFlags (because of the UINT cast) would be 0x0000FFFF, not [image] 1.

See Also

GetSubMenu


 WM_MOUSEACTIVATE

The WM_MOUSEACTIVATE message is sent when the cursor is in an inactive window and the user presses a mouse button. The parent window receives this message only if the child window passes it to the DefWindowProc function.

WM_MOUSEACTIVATE

hwndTopLevel = (HWND) wParam; // handle of top-level parent

nHittest = (INT) LOWORD(lParam); // hit-test value

uMsg = (UINT) HIWORD(lParam); // mouse message

Parameters

hwndTopLevel

Value of wParam. Identifies the top-level parent window of the window being activated.

nHittest

Value of the low-order word of lParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

uMsg

Value of the high-order word of lParam. Specifies the identifier of the mouse message generated when the user pressed a mouse button. The mouse message is either discarded or posted to the window, depending on the return value.

Return Values

The return value specifies whether the window should be activated and whether the identifier of the mouse message should be discarded. It must be one of the following values:

Value | Meaning
MA_ACTIVATE | Activates the window, and does not discard the mouse message.
MA_ACTIVATEANDEAT | Activates the window, and discards the mouse message.
MA_NOACTIVATE | Does not activate the window, and does not discard the mouse message.
MA_NOACTIVATEANDEAT | Does not activate the window, but discards the mouse message.

Default Action

The DefWindowProc function passes the message to a child window's parent window before any processing occurs. The parent window determines whether to activate the child window. If it activates the child window, the parent window should return TRUE to prevent the system from processing the message further.

See Also

DefWindowProc, WM_NCHITTEST


 WM_MOUSEMOVE

The WM_MOUSEMOVE message is posted to a window when the cursor moves. If the mouse is not captured, the message is posted to the window that contains the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_MOUSEMOVE

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

Remarks

The MAKEPOINTS macro can be used to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, MAKEPOINTS , POINTS , SetCapture


WM_MOUSEWHEEL [New - Windows NT]

 WM_MOUSEWHEEL

[New - Windows NT]

The WM_MOUSEWHEEL message is sent to the focus window when the mouse wheel is rotated. The DefWindowProc function propagates the message to the window's parent. There should be no internal forwarding of the message, since DefWindowProc propagates it up the parent chain until it finds a window that processes it.

WM_MOUSEWHEEL

fwKeys = LOWORD(wParam); // key flags

zDelta = (short) HIWORD(wParam); // wheel rotation

xPos = (short) LOWORD(lParam); // horizontal position of pointer

yPos = (short) HIWORD(lParam); // vertical position of pointer

Parameters

fwKeys

Value of the low-order word of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

zDelta

The value of the high-order word of wParam. Indicates the distance that the wheel is rotated, expressed in multiples or divisions of WHEEL_DELTA, which is 120. A positive value indicates that the wheel was rotated forward, away from the user; a negative value indicates that the wheel was rotated backward, toward the user.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the pointer, relative to the upper-left corner of the screen.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the pointer, relative to the upper-left corner of the screen.

Remarks

The zDelta parameter will be a multiple of WHEEL_DELTA, which is set at 120. This is the threshold for action to be taken, and one such action (for example, scrolling one increment) should occur for each delta.

The delta was set to 120 to allow Microsoft or other vendors to build finer-resolution wheels in the future, including perhaps a freely-rotating wheel with no notches. The expectation is that such a device would send more messages per rotation, but with a smaller value in each message. To support this possibility, you should either add the incoming delta values until WHEEL_DELTA is reached (so for a given delta-rotation you get the same response), or scroll partial lines in response to the more frequent messages. You could also choose your scroll granularity and accumulate deltas until it is reached.

See Also

GetSystemMetrics, mouse_event , SystemParametersInfo


 WM_MOVE

The WM_MOVE message is sent after a window has been moved.

WM_MOVE

xPos = (int) LOWORD(lParam); // horizontal position

yPos = (int) HIWORD(lParam); // vertical position

Parameters

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the upper-left corner of the client area of the window.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the upper-left corner of the client area of the window.

Return Values

If an application processes this message, it should return zero.

Remarks

The xPos and yPos parameters are given in screen coordinates for overlapped and pop-up windows and in parent-client coordinates for child windows.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

MAKEPOINTS, POINTS


 WM_MOVING

The WM_MOVING message is sent to a window that the user is moving. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.

fwSide = wParam; // edge of window to be moved

lprc = (LPRECT) lParam; // screen coordinates of drag rectangle

Parameters

fwSide

Value of wParam. Indicates which edge of the window is being moved. This parameter can be a combination of the following values:

Value | Meaning
WMSZ_BOTTOM | Bottom edge
WMSZ_BOTTOMLEFT | Bottom-left corner
WMSZ_BOTTOMRIGHT | Bottom-right corner
WMSZ_LEFT | Left edge
WMSZ_RIGHT | Right edge
WMSZ_TOP | Top edge
WMSZ_TOPLEFT | Top-left corner
WMSZ_TOPRIGHT | Top-right corner

lprc

Value of lParam. Address of a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure.

Return Values

An application should return TRUE if it processes this message.

See Also

RECT, WM_MOVE, WM_SIZING


 WM_NCACTIVATE

The WM_NCACTIVATE message is sent to a window when its nonclient area needs to be changed to indicate an active or inactive state.

WM_NCACTIVATE

fActive = (BOOL) wParam; // new state of the title bar or icon

Parameters

fActive

Value of wParam. Specifies when a title bar or icon needs to be changed to indicate an active or inactive state. If an active title bar or icon is to be drawn, the fActive parameter is TRUE. It is FALSE for an inactive title bar or icon.

Return Values

When the fActive parameter is FALSE, an application should return TRUE to indicate that Windows should proceed with the default processing, or it should return FALSE to prevent the title bar or icon from being deactivated. When fActive is TRUE, the return value is ignored.

Default Action

The DefWindowProc function draws the title bar or icon title in its active colors when the fActive parameter is TRUE and in its inactive colors when fActive is FALSE.

See Also

DefWindowProc


 WM_NCCALCSIZE

The WM_NCCALCSIZE message is sent when the size and position of a window's client area must be calculated. By processing this message, an application can control the content of the window's client area when the size or position of the window changes.

WM_NCCALCSIZE

fCalcValidRects = (BOOL) wParam; // valid area flag

lpncsp = (LPNCCALCSIZE_PARAMS) lParam; // points to size calculation data

or

lpncsp = (LPRECT) lParam; // points to new window coordinates

Parameters

fCalcValidRects

Value of wParam. A Boolean value that, if TRUE, specifies that the application should indicate which part of the client area contains valid information. The operating system copies the valid information to the specified area within the new client area. Also, if this parameter is TRUE, lParam points to an NCCALCSIZE_PARAMS structure.

If this parameter is FALSE, the application does not need to indicate the valid part of the client area. Also, if this parameter is FALSE, lParam points to a RECT structure.

lpncsp

Value of lParam.

If wParam is TRUE, lParam points to an NCCALCSIZE_PARAMS structure that contains information an application can use to calculate the new size and position of the client rectangle.

If wParam is FALSE, lParam points to a RECT structure that contains the new coordinates of the window that has been moved or resized. This is equivalent to rgrc[0] of an NCCALCSIZE_PARAMS structure.

Return Values

If the fCalcValidRects parameter is FALSE, the application should return zero.

If fCalcValidRects is TRUE, the application can return zero or a valid combination of the following values:

Value
Meaning
WVR_ALIGNTOP, WVR_ALIGNLEFT, WVR_ALIGNBOTTOM, WVR_ALIGNRIGHT

These values, used in combination, specify that the client area of the window is to be preserved and aligned appropriately relative to the new position of the window. For example, to align the client area to the lower-left corner, return the WVR_ALIGNLEFT and WVR_ALIGNTOP values.
WVR_HREDRAW, WVR_VREDRAW

These values, used in combination with any other values, cause the window to be completely redrawn if the client rectangle changes size horizontally or vertically. These values are similar to the CS_HREDRAW and CS_VREDRAW class styles.
WVR_REDRAW

This value causes the entire window to be redrawn. It is a combination of WVR_HREDRAW and WVR_VREDRAW values.
WVR_VALIDRECTS

This value indicates that, upon return from WM_NCCALCSIZE, the rectangles specified by the rgrc[1] and rgrc[2] members of the NCCALCSIZE_PARAMS structure contain valid source and destination area rectangles, respectively. Windows combines these rectangles to calculate the area of the window to be preserved. Windows copies any part of the window image that is within the source rectangle and clips the image to the destination rectangle. Both rectangles are in parent-relative or screen-relative coordinates.

This return value allows an application to implement more elaborate client-area preservation strategies, such as centering or preserving a subset of the client area.

If fCalcValidRects is TRUE and an application returns zero, the old client area is preserved and is aligned with the upper-left corner of the new client area.

Default Action

The window may be redrawn, depending on whether the CS_HREDRAW or CS_VREDRAW class style is specified. This is the default, backward-compatible processing of this message by the DefWindowProc function (in addition to the usual client rectangle calculation described in the preceding table).

See Also

DefWindowProc, MoveWindow , SetWindowPos , NCCALCSIZE_PARAMS , RECT


 WM_NCCREATE

The WM_NCCREATE message is sent prior to the WM_CREATE message when a window is first created.

WM_NCCREATE

lpcs = (LPCREATESTRUCT) lParam; // initialization data

Parameters

lpcs

Value of wParam. Points to the CREATESTRUCT structure for the window.

Return Values

If an application processes this message, it should return TRUE to continue creation of the window. If the application returns FALSE, the CreateWindow or CreateWindowEx function will return a NULL handle.

Default Action

The DefWindowProc function returns TRUE.

See Also

CreateWindow, CreateWindowEx , DefWindowProc , CREATESTRUCT , WM_CREATE


 WM_NCDESTROY

The WM_NCDESTROY message informs a window that its nonclient area is being destroyed. The DestroyWindow function sends the WM_NCDESTROY message to the window following the WM_DESTROY message. WM_DESTROY is used to free the allocated memory object associated with the window.

WM_NCDESTROY

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Remarks

This message frees any memory internally allocated for the window.

See Also

DestroyWindow, WM_DESTROY, WM_NCCREATE


 WM_NCHITTEST

The WM_NCHITTEST message is sent to a window when the cursor moves, or when a mouse button is pressed or released. If the mouse is not captured, the message is sent to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_NCHITTEST

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the screen.

Return Values

The return value of the DefWindowProc function is one of the following values, indicating the position of the cursor hot spot:

Value | Location of hot spot
HTBORDER | In the border of a window that does not have a sizing border
HTBOTTOM | In the lower horizontal border of a window
HTBOTTOMLEFT | In the lower-left corner of a window border
HTBOTTOMRIGHT | In the lower-right corner of a window border
HTCAPTION | In a title bar
HTCLIENT | In a client area
HTERROR | On the screen background or on a dividing line between windows (same as HTNOWHERE, except that the DefWindowProc function produces a system beep to indicate an error)
HTGROWBOX | In a size box (same as HTSIZE)
HTHSCROLL | In a horizontal scroll bar
HTLEFT | In the left border of a window
HTMENU | In a menu
HTNOWHERE | On the screen background or on a dividing line between windows
HTREDUCE | In a Minimize button
HTRIGHT | In the right border of a window
HTSIZE | In a size box (same as HTGROWBOX)
HTSYSMENU | In a System menu or in a Close button in a child window
HTTOP | In the upper horizontal border of a window
HTTOPLEFT | In the upper-left corner of a window border
HTTOPRIGHT | In the upper right corner of a window border
HTTRANSPARENT | In a window currently covered by another window
HTVSCROLL | In the vertical scroll bar
HTZOOM | In a Maximize button

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

DefWindowProc, MAKEPOINTS , POINTS


 WM_NCLBUTTONDBLCLK

The WM_NCLBUTTONDBLCLK message is posted when the user double-clicks the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCLBUTTONDBLCLK

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Default Action

The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window.

Remarks

A window need not have the CS_DBLCLKS style to receive WM_NCLBUTTONDBLCLK messages.

Windows generates a WM_NCLBUTTONDBLCLK message when the user presses, releases, and again presses the left mouse button within the system's double-click time limit. Double-clicking the left mouse button actually generates four messages: WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_NCLBUTTONDBLCLK, and WM_NCLBUTTONUP again.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCLBUTTONDOWN, WM_NCLBUTTONUP, WM_SYSCOMMAND


 WM_NCLBUTTONDOWN

The WM_NCLBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCLBUTTONDOWN

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Default Action

The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCLBUTTONDBLCLK, WM_NCLBUTTONUP, WM_SYSCOMMAND


 WM_NCLBUTTONUP

The WM_NCLBUTTONUP message is posted when the user releases the left mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCLBUTTONUP

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // mouse-cursor coordinates

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Default Action

The DefWindowProc function tests the given point to find out the location of the cursor and performs the appropriate action. If appropriate, DefWindowProc sends the WM_SYSCOMMAND message to the window.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCLBUTTONDBLCLK, WM_NCLBUTTONDOWN, WM_SYSCOMMAND


 WM_NCMBUTTONDBLCLK

The WM_NCMBUTTONDBLCLK message is posted when the user double-clicks the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCMBUTTONDBLCLK

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

A window need not have the CS_DBLCLKS style to receive WM_NCMBUTTONDBLCLK messages.

Windows generates a WM_NCMBUTTONDBLCLK message when the user presses, releases, and again presses the middle mouse button within the system's double-click time limit. Double-clicking the middle mouse button actually generates four messages: WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_NCMBUTTONDBLCLK, and WM_NCMBUTTONUP again.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCMBUTTONDOWN, WM_NCMBUTTONUP, WM_SYSCOMMAND


 WM_NCMBUTTONDOWN

The WM_NCMBUTTONDOWN message is posted when the user presses the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCMBUTTONDOWN

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCMBUTTONDBLCLK, WM_NCMBUTTONUP, WM_SYSCOMMAND


 WM_NCMBUTTONUP

The WM_NCMBUTTONUP message is posted when the user releases the middle mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCMBUTTONUP

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCMBUTTONDBLCLK, WM_NCMBUTTONDOWN, WM_SYSCOMMAND


 WM_NCMOUSEMOVE

The WM_NCMOUSEMOVE message is posted to a window when the cursor is moved within the nonclient area of the window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCMOUSEMOVE

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_SYSCOMMAND


 WM_NCPAINT

An application sends the WM_NCPAINT message to a window when its frame must be painted.

WM_NCPAINT

hrgn = (HRGN) wParam; // handle of update region

Parameters

hrgn

Value of wParam. Identifies the update region of the window. The update region is clipped to the window frame.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function paints the window frame.

An application can intercept this message and paint its own custom window frame. The clipping region for a window is always rectangular, even if the shape of the frame is altered.

See Also

DefWindowProc, GetWindowDC , WM_PAINT


 WM_NCRBUTTONDBLCLK

The WM_NCRBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCRBUTTONDBLCLK

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

A window need not have the CS_DBLCLKS style to receive WM_NCRBUTTONDBLCLK messages.

Windows generates a WM_NCRBUTTONDBLCLK message when the user presses, releases, and again presses the right mouse button within the system's double-click time limit. Double-clicking the right mouse button actually generates four messages: WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_NCRBUTTONDBLCLK, and WM_NCRBUTTONUP again.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCRBUTTONDOWN, WM_NCRBUTTONUP, WM_SYSCOMMAND


 WM_NCRBUTTONDOWN

The WM_NCRBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCRBUTTONDOWN

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCRBUTTONDBLCLK, WM_NCRBUTTONUP, WM_SYSCOMMAND


 WM_NCRBUTTONUP

The WM_NCRBUTTONUP message is posted when the user releases the right mouse button while the cursor is within the nonclient area of a window. This message is posted to the window that contains the cursor. If a window has captured the mouse, this message is not posted.

WM_NCRBUTTONUP

nHittest = (INT) wParam; // hit-test value

pts = MAKEPOINTS(lParam); // position of cursor

Parameters

nHittest

Value of wParam. Specifies the hit-test value returned by the DefWindowProc function as a result of processing the WM_NCHITTEST message. For a list of hit-test values, see WM_NCHITTEST.

pts

Value of lParam. Specifies a POINTS structure that contains the x- and y-coordinates of the cursor. The coordinates are relative to the upper-left corner of the screen.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

If it is appropriate to do so, the system sends the WM_SYSCOMMAND message to the window.

See Also

DefWindowProc, MAKEPOINTS , POINTS , WM_NCHITTEST, WM_NCRBUTTONDBLCLK, WM_NCRBUTTONDOWN, WM_SYSCOMMAND


 WM_NEXTDLGCTL

The WM_NEXTDLGCTL message is sent to a dialog box procedure to set the keyboard focus to a different control in the dialog box.

WM_NEXTDLGCTL

wCtlFocus = wParam; // identifies control for focus

fHandle = (BOOL) LOWORD(lParam); // wParam handle flag

Parameters

wCtlFocus

Value of wParam. If the fHandle parameter is TRUE, the wCtlFocus parameter identifies the control that receives the focus. If fHandle is FALSE, wCtlFocus is a flag that indicates whether the next or previous control with the WS_TABSTOP style receives the focus. If wCtlFocus is zero, the next control receives the focus; otherwise, the previous control with the WS_TABSTOP style receives the focus.

fHandle

Value of lParam. Contains a flag that indicates how Windows uses the wCtlFocus parameter. If the fHandle parameter is TRUE, wCtlFocus is a handle associated with the control that receives the focus; otherwise, wCtlFocus is a flag that indicates whether the next or previous control with the WS_TABSTOP style receives the focus.

Return Values

An application should return zero if it processes this message.

Remarks

The effect of this message differs from that of the SetFocus function because WM_NEXTDLGCTL modifies the border around the control.

Do not use the SendMessage function to send a WM_NEXTDLGCTL message if your application will concurrently process other messages that set the focus. Use the PostMessage function instead.

See Also

PostMessage, SendMessage , SetFocus


 WM_NOTIFY

The WM_NOTIFY message informs the parent window of a control that an event has occurred in the control or that the control requires some kind of information.

WM_NOTIFY

idCtrl = (int) wParam;

pnmh = (LPNMHDR) lParam;

Parameters

idCtrl

Identifier of the control sending the message. This identifier is not guaranteed to be unique. An application should use the hwindFrom or idFrom member of the NMHDR structure (passed as the lParam parameter) to identify the control.

pnmh

Pointer to an NMHDR structure that contains the notification code and additional information. For some notification messages, this parameter points to a larger structure that has the NMHDR structure as its first member.

Return Values

The return value is ignored except for notification messages that specify otherwise.

See Also

NMHDR


 WM_NOTIFYFORMAT

Common controls, custom controls, and their parent windows use the WM_NOTIFYFORMAT message to determine whether the control should use ANSI or Unicode structures in the WM_NOTIFY notification messages that the control uses to communicate with its parent window. WM_NOTIFYFORMAT messages are sent from a control to its parent window, and from the parent window to the control.

hwndFrom = (HWND) wParam; // handle of the window sending this message

Command = lParam; // command value specifying the nature of this message

Parameters

hwndFrom

Value of wParam. Handle of the window that is sending the WM_NOTIFYFORMAT message. If Command is NF_QUERY, hwndFrom is the handle of a control. If Command is NF_REQUERY, this is the handle of the parent window of a control.

Command

Value of lParam. A command value that specifies the nature of the WM_NOTIFYFORMAT message. The following values are defined:

Value | Meaning
NF_QUERY | The message is a query to determine whether ANSI or Unicode structures should be used in WM_NOTIFY messages. This command is sent from a control to its parent window. This command is sent during the creation of a control, and in response to an NF_REQUERY command.
NF_REQUERY | The message is a request that a control send an NF_QUERY form of this message to its parent window. This command is sent from a control's parent window to the control. The parent window is asking the control to requery it about the type of structures to use in WM_NOTIFY messages.

Return Values

The return value is one of the following :

Value | Meaning
NFR_ANSI | ANSI structures should be used in WM_NOTIFY messages sent by the control.
NFR_UNICODE | Unicode structures should be used in WM_NOTIFY messages sent by the control.
0 | An error occurred.

If Command is NF_REQUERY, the return value is the result of the requery operation.

Remarks

When a common control is created, the control sends a WM_NOTIFYFORMAT message to its parent window to determine the type of structures to use in WM_NOTIFY messages. If the parent window does not handle this message, the DefWindowProc function responds according to the type of the parent window. That is, if the parent window is a Unicode window, DefWindowProc returns NFR_UNICODE, and if the parent window is an ANSI window, DefWindowProc returns NFR_ANSI. If the parent window is a dialog box and does not handle this message, the DefDlgProc function similarly responds according to the type of the dialog box (Unicode or ANSI).

A parent window can change the type of structures a common control uses in WM_NOTIFY messages by setting lParam to NF_REQUERY and sending a WM_NOTIFYFORMAT message to the control. This causes the control to send an NF_QUERY form of the WM_NOTIFYFORMAT message to the parent window.

See Also

DefDlgProc, DefWindowProc , WM_NOTIFY


 WM_PAINT

An application sends the WM_PAINT message when Windows or another application makes a request to paint a portion of an application's window. The message is sent when the UpdateWindow or RedrawWindow function is called, or by the DispatchMessage function when the application obtains a WM_PAINT message by using the GetMessage or PeekMessage function.

WM_PAINT

hdc = (HDC) wParam; // the device context to draw in

Parameters

hdc

Identifies the device context to draw in. If this parameter is NULL, use the default device context. This parameter is used by some common controls to enable drawing in a device context other than the default device context. Other windows can safely ignore this parameter.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function validates the update region. The function may also send the WM_NCPAINT message to the window procedure if the window frame must be painted and send the WM_ERASEBKGND message if the window background must be erased.

The system sends this message when there are no other messages in the application's message queue. DispatchMessage determines where to send the message; GetMessage determines which message to dispatch. GetMessage returns the WM_PAINT message when there are no other messages in the application's message queue, and DispatchMessage sends the message to the appropriate window procedure.

A window may receive internal paint messages as a result of calling RedrawWindow with the RDW_INTERNALPAINT flag set. In this case, the window may not have an update region. An application should call the GetUpdateRect function to determine whether the window has an update region. If GetUpdateRect returns zero, the application should not call the BeginPaint and EndPaint functions.

An application must check for any necessary internal painting by looking at its internal data structures for each WM_PAINT message, because a WM_PAINT message may have been caused by both a non-NULL update region and a call to RedrawWindow with the RDW_INTERNALPAINT flag set.

Windows sends an internal WM_PAINT message only once. After an internal WM_PAINT message is returned from GetMessage or PeekMessage or is sent to a window by UpdateWindow, Windows does not post or send further WM_PAINT messages until the window is invalidated or until RedrawWindow is called again with the RDW_INTERNALPAINT flag set.

For some common controls, the default WM_PAINT message processing checks the wParam parameter. If wParam is non-NULL, the control assumes that the value is an HDC and paints using that device context.

See Also

BeginPaint, DefWindowProc , DispatchMessage , EndPaint , GetMessage , GetUpdateRect , PeekMessage , RedrawWindow , UpdateWindow , WM_ERASEBKGND, WM_NCPAINT


 WM_PAINTCLIPBOARD

The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting.

WM_PAINTCLIPBOARD

hwndViewer = (HWND) wParam; // handle of clipboard viewer window

hglbPs = (HGLOBAL) lParam; // handle of PAINTSTRUCT object

Parameters

hwndViewer

Value of wParam. Identifies the clipboard viewer window.

hglbPs

Value of lParam. Identifies a global DDESHARE object that contains a PAINTSTRUCT structure. The structure defines the part of the client area to paint.

Return Values

If an application processes this message, it should return zero.

Remarks

To determine whether the entire client area or just a portion of it needs repainting, the clipboard owner must compare the dimensions of the drawing area given in the rcpaint member of PAINTSTRUCT to the dimensions given in the most recent WM_SIZECLIPBOARD message.

The clipboard owner must use the GlobalLock function to lock the memory that contains the PAINTSTRUCT structure. Before returning, the clipboard owner must unlock that memory by using the GlobalUnlock function.

See Also

GlobalLock, GlobalUnlock , PAINTSTRUCT , WM_SIZECLIPBOARD


 WM_PAINTICON

The WM_PAINTICON message is sent to a minimized window when the icon is to be painted but only if the application is written for Windows 3.x. A window receives this message only if a class icon is defined for the window; otherwise, WM_PAINT is sent instead.

WM_PAINTICON

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function draws the class icon. For compatibility with Windows 3.x, wParam is TRUE. However, this value has no significance.

See Also

DefWindowProc, WM_ICONERASEBKGND, WM_PAINT


 WM_PALETTECHANGED

The WM_PALETTECHANGED message is sent to all top-level and overlapped windows after the window with the keyboard focus has realized its logical palette, thereby changing the system palette. This message enables a window that uses a color palette but does not have the keyboard focus to realize its logical palette and update its client area.

WM_PALETTECHANGED

hwndPalChg = (HWND) wParam; // handle of window that changed palette

Parameters

hwndPalChg

Value of wParam. Identifies the window that caused the system palette to change.

Remarks

This message must be sent to all top-level and overlapped windows, including the one that changed the system palette. If any child windows use a color palette, this message must be passed on to them as well.

To avoid creating an infinite loop, a window that receives this message must not realize its palette, unless it determines that wParam does not contain its own window handle.

See Also

WM_PALETTEISCHANGING, WM_QUERYNEWPALETTE


 WM_PALETTEISCHANGING

The WM_PALETTEISCHANGING message informs applications that an application is going to realize its logical palette.

WM_PALETTEISCHANGING

hwndRealize = (HWND) wParam; // window to realize palette

Parameters

hwndRealize

Value of wParam. Identifies the window that is going to realize its logical palette.

Return Values

If an application processes this message, it should return zero.

Remarks

The application changing its palette does not wait for acknowledgment of this message before changing the palette and sending the WM_PALETTECHANGED message. As a result, the palette may already be changed by the time an application receives this message.

If the application either ignores or fails to process this message and a second application realizes its palette while the first is using palette indices, there is a strong possibility that the user will see unexpected colors during subsequent drawing operations.

See Also

WM_PALETTECHANGED, WM_QUERYNEWPALETTE


 WM_PARENTNOTIFY

The WM_PARENTNOTIFY message is sent to the parent of a child window when the child window is created or destroyed, or when the user clicks a mouse button while the cursor is over the child window. When the child window is being created, the system sends WM_PARENTNOTIFY just before the CreateWindow or CreateWindowEx function that creates the window returns. When the child window is being destroyed, Windows sends the message before any processing to destroy the window takes place.

WM_PARENTNOTIFY

fwEvent = LOWORD(wParam); // event flags

idChild = HIWORD(wParam); // identifier of child window

lValue = lParam; // child handle, or cursor coordinates

Parameters

fwEvent

Value of the low-order word of wParam. Specifies the event for which the parent is being notified. This parameter can be one of the following values:

Value | Meaning
WM_CREATE | The child window is being created.
WM_DESTROY | The child window is being destroyed.
WM_LBUTTONDOWN | The user has placed the cursor over the child window and has clicked the left mouse button.
WM_MBUTTONDOWN | The user has placed the cursor over the child window and has clicked the middle mouse button.
WM_RBUTTONDOWN | The user has placed the cursor over the child window and has clicked the right mouse button.

idChild

Value of the high-order word of wParam. If the fwEvent parameter is the WM_CREATE or WM_DESTROY value, idChild specifies the identifier of the child window. Otherwise, idChild is undefined.

lValue

Contains the handle of the child window, if the fwEvent parameter is the WM_CREATE or WM_DESTROY value; otherwise, lValue contains the x- and y-coordinates of the cursor. The x-coordinate is in the low-order word and the y-coordinate is in the high-order word.

Return Values

If an application processes this message, it should return zero.

Remarks

This message is also sent to all ancestor windows of the child window, including the top-level window.

All child windows, except those that have the WS_EX_NOPARENTNOTIFY extended window style, send this message to their parent windows. By default, child windows in a dialog box have the WS_EX_NOPARENTNOTIFY style, unless the CreateWindowEx function is called to create the child window without this style.

See Also

CreateWindow, CreateWindowEx , WM_CREATE, WM_DESTROY, WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN


 WM_PASTE

An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format.

WM_PASTE

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

This message does not return a value.

Remarks

When sent to a combo box, the WM_PASTE message is handled by its edit control. This message has no effect when sent to a combo box with the CBS_DROPDOWNLIST style.

See Also

WM_CLEAR, WM_COPY, WM_CUT


 WM_POWER

The WM_POWER message is sent when the system, typically a battery-powered personal computer, is about to enter suspended mode.

The WM_POWER message is obsolete. It is provided to simplify porting of 16-bit Windows-based applications. New Win32-based applications should use the WM_POWERBROADCAST message.

WM_POWER

fwPowerEvt = wParam; // power-event notification message

Parameters

fwPowerEvt

Value of wParam. Specifies a power-event notification message. This parameter can be one of the following values:

Value | Meaning
PWR_CRITICALRESUME | Indicates that the system is resuming operation after entering suspended mode without first sending a PWR_SUSPENDREQUEST notification message to the application. An application should perform any necessary recovery actions.
PWR_SUSPENDREQUEST | Indicates that the system is about to enter suspended mode.
PWR_SUSPENDRESUME | Indicates that the system is resuming operation after having entered suspended mode normally [image] that is, the system sent a PWR_SUSPENDREQUEST notification message to the application before the system was suspended. An application should perform any necessary recovery actions.

Return Values

The value an application returns depends on the value of the wParam parameter. If wParam is PWR_SUSPENDREQUEST, the return value is PWR_FAIL to prevent the system from entering the suspended state; otherwise, it is PWR_OK. If wParam is PWR_SUSPENDRESUME or PWR_CRITICALRESUME, the return value is zero.

Remarks

This message is sent only to an application that is running on a system that conforms to the Advanced Power Management (APM) basic input/output system (BIOS) specification. The message is sent by the power-management driver to each window returned by the EnumWindows function.

The suspended mode is the state in which the greatest amount of power savings occurs, but all operational data and parameters are preserved. Random-access memory (RAM) contents are preserved, but many devices are likely to be turned off.

See Also

EnumWindows, WM_POWERBROADCAST


 WM_POWERBROADCAST

The WM_POWERBROADCAST message is sent to an application to notify it of power-management events.

dwPowerEvent = (DWORD) wParam;
dwData = (DWORD) lParam;

Parameters

dwPowerEvent

Event notification message. This parameter can be one of the following values:

Value | Meaning
PBT_APMBATTERYLOW | Battery power is low.
PBT_APMOEMEVENT | OEM-defined event occurred.
PBT_APMPOWERSTATUSCHANGE | Power status has changed.
PBT_APMQUERYSUSPEND | Request for permission to suspend.
PBT_APMQUERYSUSPENDFAILED | Suspension request denied.
PBT_APMRESUMECRITICAL | Operation resuming after critical suspension.
PBT_APMRESUMESUSPEND | Operation resuming after suspension.
PBT_APMSUSPEND | System is suspending operation.

dwData

Function-specific data. For most messages, this parameter is reserved and not used.

However, if wParam is one of the resume notifications (PBT_APMRESUME*), the lParam parameter can specify the PBTF_APMRESUMEFROMFAILURE flag. This flag indicates that a suspend operation failed after the PBT_APMSUSPEND message was sent.

Return Values

Return TRUE to grant a request.

Return BROADCAST_QUERY_DENY to deny a request.


 WM_PRINT

The WM_PRINT message is sent to a window to request that it draw itself in the specified device context, most commonly in a printer device context.

WM_PRINT

hdc = (HDC) wParam;

uFlags = lParam;

Parameters

hdc

Identifies the device context to draw in.

uFlags

Specifies the drawing options. This parameter can be one or more of these flags:

Value | Meaning
PRF_CHECKVISIBLE | Draw the window only if it is visible.
PRF_CHILDREN | Draw all visible children windows.
PRF_CLIENT | Draw the client area of the window.
PRF_ERASEBKGND | Erase the background before drawing the window.
PRF_NONCLIENT | Draw the nonclient area of the window.
PRF_OWNED | Draw all owned windows.

Remarks

The DefWindowProc function processes this message based on which drawing option is specified: if PRF_CHECKVISIBLE is specified and the window is not visible, do nothing, if PRF_NONCLIENT is specified, draw the nonclient area in the given device context, if PRF_ERASEBKGND is specified, send the window a WM_ERASEBKGND message, if PRF_PRINTCLIENT is specified, send the window a WM_PRINTCLIENT message, if PRF_PRINTCHILDREN is set, send each visible child window a WM_PRINT message, if PRF_OWNED is set, send each visible owned window a WM_PRINT message.

See Also

DefWindowProc, WM_ERASEBKGND, WM_PRINTCLIENT


 WM_PRINTCLIENT

The WM_PRINTCLIENT message is sent to a window to request that it draw its client area in the specified device context, most commonly in a printer device context.

WM_PRINTCLIENT

hdc = (HDC) wParam;

uFlags = lParam;

Parameters

hdc

Identifies the device context to draw in.

uFlags

Specifies drawing options. This parameter can be one or more of these flags:

Value | Meaning
PRF_CHECKVISIBLE | Draw the window only if it is visible.
PRF_CHILDREN | Draw all visible children windows.
PRF_CLIENT | Draw the client area of the window.
PRF_ERASEBKGND | Erase the background before drawing the window.
PRF_NONCLIENT | Draw the nonclient area of the window.
PRF_OWNED | Draw all owned windows.

Remarks

A window can process this message in much the same manner as WM_PAINT, except that BeginPaint and EndPaint need not be called (a device context is provided), and the window should draw its entire client area rather than just the invalid region.

Windows that can be used anywhere in the system, such as controls, should process this message. It is probably worthwhile for other windows to process this message as well because it is relatively easy to implement.

See Also

BeginPaint, EndPaint , WM_PAINT


 WM_PSD_ENVSTAMPRECT

The WM_PSD_ENVSTAMPRECT message notifies the hook procedure of a Page Setup dialog box that the dialog box is about to draw the envelope-stamp rectangle of the sample page.

WM_PSD_ENVSTAMPRECT

hDC = (WPARAM) (HDC) wParam; // handle of the device context

lprcEnvStamp = (LPARAM) (LPRECT) lParam; // envelope-stamp rectangle

Parameters

hDC

Value of wParam. Identifies the device context for the sample page.

lprcMargin

Value of lParam. Pointer to a RECT structure that contains the coordinates, in pixels, of the envelope-stamp rectangle.

Return Values

If the hook procedure returns TRUE, the dialog box does not draw the envelope-stamp portion of the sample page.

If the hook procedure returns FALSE, the dialog box draws the envelope-stamp portion of the sample page.

Remarks

The Page Setup dialog box includes an image of a sample page that shows how the user's selections affect the appearance of the printed output. When you call the PageSetupDlg function, you can provide a PagePaintHook hook procedure to customize the appearance of the sample page. Whenever the dialog box is about to draw the contents of the sample page, the dialog box sends a sequence of WM_PSD* messages to the hook procedure.

A hook procedure receives this message only if the selected paper type is an envelope.

See Also

PagePaintHook, PageSetupDlg , RECT , WM_PSD_PAGESETUPDLG


 WM_PSD_FULLPAGERECT

The WM_PSD_FULLPAGERECT message informs a PagePaintHook hook procedure of the coordinates of the sample page rectangle in the Page Setup dialog box. The dialog box sends this message when it is about to draw the contents of the sample page.

WM_PSD_FULLPAGERECT

hDC = (WPARAM) (HDC) wParam; // handle of the device context

lprcPage = (LPARAM) (LPRECT) lParam; // dimensions of page rectangle

Parameters

hDC

Value of wParam. Handle of the device context for the sample page.

lprcPage

Value of lParam. Pointer to a RECT structure that contains the coordinates, in pixels, of the sample page.

Return Values

If the hook procedure returns TRUE, the dialog box sends no more WM_PSD* messages and does not draw in the sample page until the next time the system needs to redraw the sample page.

If the hook procedure returns FALSE, the dialog box sends the remaining messages of the drawing sequence.

Remarks

The Page Setup dialog box includes an image of a sample page that shows how the user's selections affect the appearance of the printed output. When you call the PageSetupDlg function, you can provide a PagePaintHook hook procedure to customize the appearance of the sample page. Whenever the dialog box is about to draw the contents of the sample page, the dialog box sends a sequence of WM_PSD* messages to the hook procedure.

See Also

PagePaintHook, PageSetupDlg , RECT , WM_PSD_PAGESETUPDLG


 WM_PSD_GREEKTEXTRECT

The WM_PSD_GREEKTEXTRECT message notifies the hook procedure of a Page Setup dialog box that the dialog box is about to draw greek text inside the margin rectangle of the sample page.

WM_PSD_GREEKTEXTRECT

hDC = (WPARAM) (HDC) wParam; // handle of the device context

lprcGreekText = (LPARAM) (LPRECT) lParam; // greek text rectangle

Parameters

hDC

Value of wParam. Identifies the device context for the sample page.

lprcMargin

Value of lParam. Pointer to a RECT structure that contains the coordinates, in pixels, of the greek text rectangle.

Return Values

If the hook procedure returns TRUE, the dialog box does not draw the greek text portion of the sample page.

If the hook procedure returns FALSE, the dialog box draws the greek text portion of the sample page.

Remarks

The Page Setup dialog box includes an image of a sample page that shows how the user's selections affect the appearance of the printed output. When you call the PageSetupDlg function, you can provide a PagePaintHook hook procedure to customize the appearance of the sample page. Whenever the dialog box is about to draw the contents of the sample page, the dialog box sends a sequence of WM_PSD* messages to the hook procedure.

See Also

PagePaintHook, PageSetupDlg , RECT , WM_PSD_PAGESETUPDLG


 WM_PSD_MARGINRECT

The WM_PSD_MARGINRECT message notifies the hook procedure of a Page Setup dialog box that the dialog box is about to draw the margin rectangle of the sample page.

WM_PSD_MARGINRECT

hDC = (WPARAM) (HDC) wParam; // handle of the device context

lprcMargin = (LPARAM) (LPRECT) lParam; // margin rectangle

Parameters

hDC

Value of wParam. Identifies the device context for the sample page.

lprcMargin

Value of lParam. Pointer to a RECT structure that contains the coordinates, in pixels, of the margin rectangle.

Return Values

If the hook procedure returns TRUE, the dialog box does not draw the margin rectangle in the sample page.

If the hook procedure returns FALSE, the dialog box draws the margin rectangle in the sample page.

Remarks

The Page Setup dialog box includes an image of a sample page that shows how the user's selections affect the appearance of the printed output. When you call the PageSetupDlg function, you can provide a PagePaintHook hook procedure to customize the appearance of the sample page. Whenever the dialog box is about to draw the contents of the sample page, the dialog box sends a sequence of WM_PSD* messages to the hook procedure.

See Also

PagePaintHook, PageSetupDlg , RECT , WM_PSD_PAGESETUPDLG


 WM_PSD_MINMARGINRECT

The WM_PSD_MINMARGINRECT message informs a PagePaintHook hook procedure of the coordinates of the margin rectangle in the sample page. A Page Setup dialog box sends this message when it is about to draw the contents of the sample page.

WM_PSD_MINMARGINRECT

hDC = (WPARAM) (HDC) wParam; // handle of the device context

lprcMinMargin = (LPARAM) (LPRECT) lParam; // minimum margin rectangle

Parameters

hDC

Value of wParam. Identifies the device context for the sample page.

lprcMinMargin

Value of lParam. Pointer to a RECT structure that contains the coordinates, in pixels, of the minimum margin rectangle.

Return Values

If the hook procedure returns TRUE, the dialog box sends no more WM_PSD* messages and does not draw in the sample page until the next time the system needs to redraw the sample page.

If the hook procedure returns FALSE, the dialog box sends the remaining messages of the drawing sequence.

Remarks

The Page Setup dialog box includes an image of a sample page that shows how the user's selections affect the appearance of the printed output. When you call the PageSetupDlg function, you can provide a PagePaintHook hook procedure to customize the appearance of the sample page. Whenever the dialog box is about to draw the contents of the sample page, the dialog box sends a sequence of WM_PSD* messages to the hook procedure.

See Also

PagePaintHook, PageSetupDlg , RECT , WM_PSD_PAGESETUPDLG


 WM_PSD_PAGESETUPDLG

The WM_PSD_PAGESETUPDLG message notifies a PagePaintHook hook procedure that the Page Setup dialog box is about to draw the contents of the sample page. The hook procedure can use this message to carry out initialization tasks related to drawing the contents of the sample page.

WM_PSD_PAGESETUPDLG

wPaper = LOWORD(wParam); // paper-size flag

wFlags = HIWORD(wParam); // paper-orientation flag

lppsd = (LPPAGESETUPDLG) lParam; // dialog box information

Parameters

wPaper

Value of the low-order word of wParam. Specifies a value that indicates the paper size. This value can be one of the DMPAPER_ values listed in the description of the DEVMODE structure.

wFlags

Value of the high-order word of wParam. Indicates the orientation of the paper or envelope, and whether the printer is a dot matrix or HPPCL (Hewlett Packard Printer Control Language) device. This parameter can be one of the following values:

  1. x0001
Paper in landscape mode (dot matrix)
0x0003
Paper in landscape mode (HPPCL)
0x0005
Paper in portrait mode (dot matrix)
0x0007
Paper in portrait mode (HPPCL)
0x000b
Envelope in landscape mode (HPPCL)
0x000d
Envelope in portrait mode (dot matrix)
0x0019
Envelope in landscape mode (dot matrix)
0x001f
Envelope in portrait mode (HPPCL)

lppsd

Value of lParam. Points to a PAGESETUPDLG structure that contains information used to initialize the Page Setup dialog box.

Return Values

If the hook procedure returns TRUE, the dialog box sends no more WM_PSD* messages and does not draw in the sample page until the next time the system needs to redraw the sample page.

If the hook procedure returns FALSE, the dialog box sends the remaining messages of the drawing sequence.

Remarks

The Page Setup dialog box includes an image of a sample page that shows how the user's selections affect the appearance of the printed output. When you call the PageSetupDlg function, you can provide a PagePaintHook hook procedure to customize the appearance of the sample page. Whenever the dialog box is about to draw the contents of the sample page, the dialog box sends a sequence of WM_PSD* messages to the hook procedure.

The first three messages of a drawing sequence (WM_PSD_PAGESETUPDLG, WM_PSD_FULLPAGERECT, or WM_PSD_MINMARGINRECT) provide information that the hook procedure can use to draw the contents of the sample page. The remaining messages (WM_PSD_MARGINRECT, WM_PSD_GREEKTEXTRECT, WM_PSD_ENVSTAMPRECT, WM_PSD_YAFULLPAGERECT) notify the hook procedure that the dialog box is about to draw a specific portion of the sample page. This allows the hook procedure to selectively draw portions of the sample page.

See Also

DEVMODE, PagePaintHook , PageSetupDlg , PAGESETUPDLG , WM_PSD_ENVSTAMPRECT, WM_PSD_FULLPAGERECT, WM_PSD_GREEKTEXTRECT, WM_PSD_MARGINRECT, WM_PSD_MINMARGINRECT, WM_PSD_YAFULLPAGERECT


 WM_PSD_YAFULLPAGERECT

The WM_PSD_YAFULLPAGERECT message notifies the hook procedure of a Page Setup dialog box that the dialog box is about to draw the return address portion of an envelope sample page.

WM_PSD_YAFULLPAGERECT

hDC = (WPARAM) (HDC) wParam; // handle of the device context

lprcYaFullPage = (LPARAM) (LPRECT) lParam; // dimensions of page rectangle

Parameters

hDC

Value of wParam. Handle of the device context for the sample page.

lprcPage

Value of lParam. Pointer to a RECT structure that contains the coordinates, in pixels, of the sample page.

Return Values

If the hook procedure returns TRUE, the dialog box does not draw the return address portion of an envelope sample page.

If the hook procedure returns FALSE, the dialog box draws the return address portion of an envelope sample page.

If the paper type is not an envelope, the return value has no effect.

Remarks

The Page Setup dialog box includes an image of a sample page that shows how the user's selections affect the appearance of the printed output. When you call the PageSetupDlg function, you can provide a PagePaintHook hook procedure to customize the appearance of the sample page. Whenever the dialog box is about to draw the contents of the sample page, the dialog box sends a sequence of WM_PSD* messages to the hook procedure.

See Also

PagePaintHook, PageSetupDlg , RECT , WM_PSD_PAGESETUPDLG


 WM_QUERYDRAGICON

The WM_QUERYDRAGICON message is sent to a minimized (iconic) window. The window is about to be dragged by the user but does not have an icon defined for its class. An application can return the handle of an icon or cursor. The system displays this cursor or icon while the user drags the icon.

WM_QUERYDRAGICON

Parameters

This message has no parameters.

Return Values

An application should return the handle of a cursor or icon that Windows is to display while the user drags the icon. The cursor or icon must be compatible with the display driver's resolution. If the application returns NULL, the system displays the default cursor.

Default Action

The DefWindowProc function returns the handle of the default cursor.

Remarks

When the user drags the icon of a window without a class icon, Windows replaces the icon with a default cursor. If the application requires a different cursor to be displayed during dragging, it must return the handle of the cursor or icon compatible with the display driver's resolution. If an application returns the handle of a color cursor or icon, the system converts the cursor or icon to black and white. The application can call the LoadCursor or LoadIcon function to load a cursor or icon from the resources in its executable (.EXE) file and to retrieve this handle.

See Also

DefWindowProc, LoadCursor , LoadIcon


 WM_QUERYENDSESSION

The WM_QUERYENDSESSION message is sent when the user chooses to end the Windows session or when an application calls the ExitWindows function. If any application returns zero, the Windows session is not ended. Windows stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.

After processing this message, Windows sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.

WM_QUERYENDSESSION

nSource = (UINT) wParam; // source of end-session request

fLogOff = lParam // logoff flag

Parameters

nSource

Reserved for future use.

fLogOff

Value of lParam. Indicates whether the user is logging off or shutting down the system. Supported values include: ENDSESSION_LOGOFF.

Return Values

If an application can terminate conveniently, it should return TRUE; otherwise, it should return FALSE.

Remarks

By default, the DefWindowProc function returns TRUE for this message.

Windows NT: When an application returns TRUE for this message, it receives the WM_ENDSESSION message and it is terminated, regardless of how the other applications respond to the WM_QUERYENDSESSION message.

Windows 95: After all applications return TRUE for this message, they receive the WM_ENDSESSION and they are terminated.

See Also

DefWindowProc, ExitWindows , WM_ENDSESSION


 WM_QUERYNEWPALETTE

The WM_QUERYNEWPALETTE message informs a window that it is about to receive the keyboard focus, giving the window the opportunity to realize its logical palette when it receives the focus.

WM_QUERYNEWPALETTE

Parameters

This message has no parameters.

Return Values

If the window realizes its logical palette, it must return TRUE; otherwise, it must return FALSE.

See Also

WM_PALETTECHANGED, WM_PALETTEISCHANGING


 WM_QUERYOPEN

The WM_QUERYOPEN message is sent to an icon when the user requests that the window be restored to its previous size and position.

WM_QUERYOPEN

Parameters

This message has no parameters.

Return Values

If the icon can be opened, an application that processes this message should return TRUE; otherwise, it should return FALSE to prevent the icon from being opened.

Default Action

The DefWindowProc function returns TRUE.

Remarks

While processing this message, the application should not perform any action that would cause an activation or focus change (for example, creating a dialog box).

See Also

DefWindowProc


 WM_QUEUESYNC

The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK hook procedure.

WM_QUEUESYNC

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

A CBT application should return zero if it processes this message.

Remarks

Whenever a CBT application uses the WH_JOURNALPLAYBACK hook procedure, the first and last messages are WM_QUEUESYNC. This allows the CBT application to intercept and examine user-initiated messages without doing so for events that it sends.

If an application specifies a NULL window handle, the message is posted to the message queue of the active window.


 WM_QUIT

The WM_QUIT message indicates a request to terminate an application and is generated when the application calls the PostQuitMessage function. It causes the GetMessage function to return zero.

WM_QUIT

nExitCode = (int) wParam; // exit code

Parameters

nExitCode

Value of wParam. Specifies the exit code given in the PostQuitMessage function.

Return Values

This message does not have a return value, because it causes the message loop to terminate before the message is sent to the application's window procedure.

See Also

GetMessage, PostQuitMessage


 WM_RASDIALEVENT

The operating system sends a WM_RASDIALEVENT message to a window procedure when a change of state event occurs during a RAS connection process, and a window has been specified to handle notifications of such events by using the notifier parameter of RasDial .

The two message parameters are equivalent to the parameters of the same names that are used with RasDialFunc and RasDialFunc1 callback functions.

WM_RASDIALEVENT

rasconnstate = (RASCONNSTATE) wParam; // connection state about to be entered

dwError = (DWORD) lParam; // error that may have occurred

Parameters

rasconnstate

Value of wParam. Equivalent to the rasconnstate parameter of the RasDialFunc and RasDialFunc1 callback functions. Specifies a RASCONNSTATE enumerator value that indicates the state the RasDial remote access connection process is about to enter.

dwError

Value of lParam. Equivalent to the dwError parameter of the RasDialFunc and RasDialFunc1 callback functions. A nonzero value indicates the error that has occurred, or zero if no error has occurred.

RasDial sends this message with dwError set to zero upon entry to each connection state. If an error occurs within a state, the message is sent again for the state, this time with a nonzero dwError value.

Return Values

If an application processes this message, it should return TRUE.

See Also

RasDial, RasDialFunc , RasDialFunc1 , RASCONNSTATE


 WM_RBUTTONDBLCLK

The WM_RBUTTONDBLCLK message is posted when the user double-clicks the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_RBUTTONDBLCLK

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

Only windows that have the CS_DBLCLKS style can receive WM_RBUTTONDBLCLK messages, which Windows generates whenever the user presses, releases, and again presses the right mouse button within the system's double-click time limit. Double-clicking the right mouse button actually generates four messages: WM_RBUTTONDOWN, WM_RBUTTONUP, WM_RBUTTONDBLCLK, and WM_RBUTTONUP again.

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, GetDoubleClickTime , MAKEPOINTS , POINTS , SetCapture , SetDoubleClickTime , WM_RBUTTONDOWN, WM_RBUTTONUP


 WM_RBUTTONDOWN

The WM_RBUTTONDOWN message is posted when the user presses the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_RBUTTONDOWN

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_RBUTTON | Set if the right mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, MAKEPOINTS , POINTS , SetCapture , WM_RBUTTONDBLCLK, WM_RBUTTONUP


 WM_RBUTTONUP

The WM_RBUTTONUP message is posted when the user releases the right mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

WM_RBUTTONUP

fwKeys = wParam; // key flags

xPos = LOWORD(lParam); // horizontal position of cursor

yPos = HIWORD(lParam); // vertical position of cursor

Parameters

fwKeys

Value of wParam. Indicates whether various virtual keys are down. This parameter can be any combination of the following values:

Value | Description
MK_CONTROL | Set if the CTRL key is down.
MK_LBUTTON | Set if the left mouse button is down.
MK_MBUTTON | Set if the middle mouse button is down.
MK_SHIFT | Set if the SHIFT key is down.

xPos

Value of the low-order word of lParam. Specifies the x-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area.

yPos

Value of the high-order word of lParam. Specifies the y-coordinate of the cursor. The coordinate is relative to the upper left corner of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

An application can use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.

See Also

GetCapture, MAKEPOINTS , POINTS , SetCapture , WM_RBUTTONDBLCLK, WM_RBUTTONDOWN


 WM_RENDERALLFORMATS

The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function.

WM_RENDERALLFORMATS

Parameters

This message has no parameters.

Return Values

If an application processes this message, it should return zero.

Remarks

When responding to a WM_RENDERALLFORMATS message, the clipboard owner must call the OpenClipboard and EmptyClipboard functions before calling SetClipboardData.

When the application returns, the system removes any unrendered formats from the list of available clipboard formats. For information about delayed rendering, see SetClipboardData.

See Also

EmptyClipboard, OpenClipboard , SetClipboardData , WM_RENDERFORMAT


 WM_RENDERFORMAT

The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function.

WM_RENDERFORMAT

uFormat = (UINT) wParam; // clipboard format

Parameters

uFormat

Specifies the clipboard format to be rendered.

Return Values

If an application processes this message, it should return zero.

Remarks

When responding to a WM_RENDERFORMAT message, the clipboard owner must not open the clipboard before calling SetClipboardData.

See Also

SetClipboardData, WM_RENDERALLFORMATS


 WM_SETCURSOR

The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured.

WM_SETCURSOR

hwnd = (HWND) wParam; // handle of window with cursor

nHittest = LOWORD(lParam); // hit-test code

wMouseMsg = HIWORD(lParam); // mouse-message identifier

Parameters

hwnd

Value of wParam. Identifies the window that contains the cursor.

nHittest

Value of the low-order word of lParam. Specifies the hit-test code.

wMouseMsg

Value of the high-order word of lParam. Specifies the identifier of the mouse message.

Default Action

The DefWindowProc function passes the WM_SETCURSOR message to a parent window before processing. If the parent window returns TRUE, further processing is halted. Passing the message to a window's parent window gives the parent window control over the cursor's setting in a child window. The DefWindowProc function also uses this message to set the cursor to an arrow if it is not in the client area, or to the registered class cursor if it is in the client area. If the low-order word of the lParam parameter is HTERROR and the high-order word of lParam specifies that one of the mouse buttons is pressed, DefWindowProc calls the MessageBeep function.

Remarks

The high-order word of lParam is zero when the window enters menu mode.

See Also

DefWindowProc, MessageBeep


 WM_SETFOCUS

The WM_SETFOCUS message is sent to a window after it has gained the keyboard focus.

WM_SETFOCUS

hwndLoseFocus = (HWND) wParam; // handle of window losing focus

Parameters

hwndLoseFocus

Value of wParam. Identifies the window that has lost the keyboard focus (may be NULL).

Return Values

An application should return zero if it processes this message.

Remarks

To display a caret, an application should call the appropriate caret functions when it receives the WM_SETFOCUS message.

See Also

SetFocus, WM_KILLFOCUS


 WM_SETFONT

An application sends a WM_SETFONT message to specify the font that a control is to use when drawing text.

WM_SETFONT

wParam = (WPARAM) hfont; // handle of font

lParam = MAKELPARAM(fRedraw, 0); // redraw flag

Parameters

hfont

Value of wParam. Identifies the font. If this parameter is NULL, the control uses the default system font to draw text.

fRedraw

Value of lParam. Specifies whether the control should be redrawn immediately upon setting the font. Setting the fRedraw parameter to TRUE causes the control to redraw itself.

Return Values

This message does not return a value.

Remarks

The WM_SETFONT message applies to all controls, not just those in dialog boxes.

The best time for the owner of a dialog box control to set the font of the control is when it receives the WM_INITDIALOG message. The application should call the DeleteObject function to delete the font when it is no longer needed; for example, after it destroys the control.

The size of the control does not change as a result of receiving this message. To avoid clipping text that does not fit within the boundaries of the control, the application should correct the size of the control window before it sets the font.

When a dialog box uses the DS_SETFONT style to set the text in its controls, Windows sends the WM_SETFONT message to the dialog box procedure before it creates the controls. An application can create a dialog box that contains the DS_SETFONT style by calling any of the following functions:

  • CreateDialogIndirect

  • CreateDialogIndirectParam

  • DialogBoxIndirect

  • DialogBoxIndirectParam

See Also

CreateDialogIndirect, CreateDialogIndirectParam , DeleteObject , DialogBoxIndirect , DialogBoxIndirectParam , WM_INITDIALOG, DLGTEMPLATE


 WM_SETHOTKEY

An application sends a WM_SETHOTKEY message to a window to associate a hot key with the window. When the user presses the hot key, the system activates the window.

WM_SETHOTKEY

wParam = (WPARAM) MAKEWORD(vkey, modifiers) // virtual-key code and modifiers of hot key

lParam = 0; // not used; must be zero

Parameters

  • key

Value of wParam. Specifies the virtual-key code and modifiers of the hot key to associate with the window. The virtual-key code is in the low byte of the parameter and the modifier flags are in the high byte. Setting this parameter to NULL removes the hot key associated with a window. The modifier byte can be a combination of the following flags:

Value | Meaning
HOTKEYF_ALT | ALT key
HOTKEYF_CONTROL | CTRL key
HOTKEYF_EXT | Extended key
HOTKEYF_SHIFT | SHIFT key

Return Values

The return value is one of the following:

Value | Meaning
1 | The function is unsuccessful [image] the hot key is invalid.
..0 | The function is unsuccessful [image] the window is invalid.
..1 | The function is successful, and no other window has the same hot key.
..2 | The function is successful, but another window already has the same hot key.

Remarks

A hot key cannot be associated with a child window.

VK_ESCAPE, VK_SPACE, and VK_TAB are invalid hot keys.

When the user presses the hot key, the system generates a WM_SYSCOMMAND message with wParam equal to SC_HOTKEY.

A window can only have one hot key. If the window already has a hot key associated with it, the new hot key replaces the old one. If more than one window has the same hot key, the window that is activated by the hot key is random.

These hot keys are unrelated to the hot keys set by RegisterHotKey.

See Also

RegisterHotKey, WM_GETHOTKEY, WM_SYSCOMMAND


 WM_SETICON

An application sends the WM_SETICON message to associate a new large or small icon with a window. Windows draws the large icon when the window is minimized, and the small icon in the window's title bar.

WM_SETICON

wParam = (WPARAM) fType; // icon type

lParam = (LPARAM) (HICON) hicon; // handle of icon

Parameters

fType

Value of wParam. Specifies the type of icon being set. This parameter can be one of the following values:

Value | Meaning
ICON_BIG | Set the large icon for the window.
ICON_SMALL | Set the small icon for the window.
hicon

Value of lParam. Identifies the new large or small icon. If this parameter is NULL, the icon indicated by fType is removed.

Return Values

The return value is the handle of the previous large or small icon, depending on the value of fType. It is NULL if the window previously had no icon of the type indicated by fType.

Default Action

The DefWindowProc function returns the handle of the previous large or small icon associated with the window, depending on the value of fType.

See Also

DefWindowProc, WM_GETICON


 WM_SETREDRAW

An application sends the WM_SETREDRAW message to a window to allow changes in that window to be redrawn or to prevent changes in that window from being redrawn.

WM_SETREDRAW

wParam = (WPARAM) fRedraw; // state of redraw flag

lParam = 0; // not used; must be zero

Parameters

fRedraw

Value of wParam. Specifies the state of the redraw flag. If this parameter is TRUE, the redraw flag is set. If the parameter is FALSE, the flag is cleared.

Return Values

An application should return zero if it processes this message.

Remarks

This message sets or clears the redraw flag. If the redraw flag is cleared, the content of the given window is not updated after each change, and the window is not repainted until the redraw flag is set. For example, an application that must add several items to a list box can clear the redraw flag, add the items, and then set the redraw flag. Finally, the application can call the InvalidateRect function to cause the list box to be repainted.

See Also

InvalidateRect


 WM_SETTEXT

An application sends a WM_SETTEXT message to set the text of a window.

WM_SETTEXT

wParam = 0; // not used; must be zero

lParam = (LPARAM)(LPCTSTR)lpsz; // address of window-text string

Parameters

lpsz

Value of lParam. Points to a null-terminated string that is the window text.

Return Values

The return value is TRUE if the text is set. It is FALSE (for an edit control), LB_ERRSPACE (for a list box), or CB_ERRSPACE (for a combo box) if insufficient space is available to set the text in the edit control. It is CB_ERR if this message is sent to a combo box without an edit control.

Default Action

The DefWindowProc function sets and displays the window text.

Remarks

For an edit control, the text is the contents of the edit control. For a combo box, the text is the contents of the edit-control portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title.

This message does not change the current selection in the list box of a combo box. An application should use the CB_SELECTSTRING message to select the item in a list box that matches the text in the edit control.

See Also

DefWindowProc, CB_SELECTSTRING, WM_GETTEXT


 WM_SETTINGCHANGE

The system sends the WM_SETTINGCHANGE message to all top-level windows when the SystemParametersInfo function changes a system-wide setting. The system sends this message only if the SystemParametersInfo caller specifies the SPIF_SENDCHANGE flag.

An application can send WM_SETTINGCHANGE to all top-level windows when it makes changes to system parameters. For example, you can send this message after a call to the WriteProfileString , WriteProfileSection , or SetLocaleInfo functions, or after making changes to system parameters in the registry.

The WM_SETTINGCHANGE message is the same as the older WM_WININICHANGE message.

WM_SETTINGCHANGE

wParam = wFlag; // system-wide parameter flag

lParam = (LPARAM) (LPCTSTR) pszSection; // name of changed section or registry

Parameters

wFlag

Value of wParam. When the system sends the message as a result of a SystemParametersInfo call, this parameter is a flag that indicates the system parameter that was changed. For a list of values, see the SystemParametersInfo function.

When an application sends the message, this parameter must be NULL.

pszMetrics

Value of lParam. Pointer to a string that indicates the area containing the system parameter that was changed. For example, this string can be the name of a registry key or the name of a section in the WIN.INI file.

This parameter is not particularly useful in determining which system parameter changed. For example, when the string is a registry name, it typically indicates only the leaf node in the registry, not the whole path. In addition, some applications send this message with lParam set to NULL. In general, when you receive this message, you should check and reload any system parameter settings that are used by your application.

Return Values

If you process this message, return zero.

Remarks

To send the WM_SETTINGCHANGE message to all top-level windows, use the SendMessage function with the hwnd parameter set to HWND_BROADCAST.

Calls to functions that change the WIN.INI file might be mapped to the registry instead. This mapping occurs when the WIN.INI file and the section being changed are specified in the registry under the following keys:

HKEY_LOCAL_MACHINE\Software\Microsoft\
Windows NT\CurrentVersion\IniFileMapping

The change in the storage location has no effect on the behavior of this message.

See Also

SendMessage, SetLocaleInfo , SystemParametersInfo , WM_WININICHANGE, WriteProfileSection , WriteProfileString


 WM_SHOWWINDOW

The WM_SHOWWINDOW message is sent to a window when the window is about to be hidden or shown.

WM_SHOWWINDOW

fShow = (BOOL) wParam; // show/hide flag

fnStatus = (int) lParam; // status flag

Parameters

fShow

Value of wParam. Specifies whether a window is being shown. It is TRUE if the window is being shown or FALSE if the window is being hidden.

fnStatus

Value of lParam. Specifies the status of the window being shown. The fnStatus parameter is zero if the message is sent because of a call to the ShowWindow function; otherwise, fnStatus is one of the following values:

Value | Meaning
SW_OTHERUNZOOM | Window is being uncovered because a maximize window was restored or minimized.
SW_OTHERZOOM | Window is being covered by another window that has been maximized.
SW_PARENTCLOSING | Window's owner window is being minimized.
SW_PARENTOPENING | Window's owner window is being restored.

Return Values

If an application processes this message, it should return zero.

Default Action

The DefWindowProc function hides or shows the window, as specified by the message.

Remarks

If a window has the WS_VISIBLE style when it is created, the window receives this message after it is created, but before it is displayed. A window also receives this message when its visibility state is changed by the ShowWindow or ShowOwnedPopups function.

The WM_SHOWWINDOW message is not sent under the following circumstances:

  • When a top-level, overlapped window is created with the WS_MAXIMIZE or WS_MINIMIZE style.

  • When the SW_SHOWNORMAL flag is specified in the call to the ShowWindow function.

See Also

DefWindowProc, ShowOwnedPopups , ShowWindow


 WM_SIZE

The WM_SIZE message is sent to a window after its size has changed.

WM_SIZE

fwSizeType = wParam; // resizing flag

nWidth = LOWORD(lParam); // width of client area

nHeight = HIWORD(lParam); // height of client area

Parameters

fwSizeType

Value of wParam. Specifies the type of resizing requested. This parameter can be one of the following values:

Value | Meaning
SIZE_MAXHIDE | Message is sent to all pop-up windows when some other window is maximized.
SIZE_MAXIMIZED | Window has been maximized.
SIZE_MAXSHOW | Message is sent to all pop-up windows when some other window has been restored to its former size.
SIZE_MINIMIZED | Window has been minimized.
SIZE_RESTORED | Window has been resized, but neither the SIZE_MINIMIZED nor SIZE_MAXIMIZED value applies.

nWidth

Value of the low-order word of lParam. Specifies the new width of the client area.

nHeight

Value of the high-order word of lParam. Specifies the new height of the client area.

Return Values

If an application processes this message, it should return zero.

Remarks

If the SetScrollPos or MoveWindow function is called for a child window as a result of the WM_SIZE message, the bRedraw parameter should be nonzero to cause the window to be repainted.

Although the width and height of a window are 32-bit values, the nWidth and nHeight parameters of the WM_SIZE message contain only the low-order 16 bits.

See Also

MoveWindow, SetScrollPos


 WM_SIZECLIPBOARD

The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size.

WM_SIZECLIPBOARD

hwndViewer = (HWND) wParam; // handle of clipboard viewer window

hglbRc = (HGLOBAL) lParam; // handle of RECT object

Parameters

hwndViewer

Value of wParam. Identifies the clipboard viewer window.

hglbRc

Value of lParam. Identifies a global memory object that contains a RECT structure. The structure specifies the new dimensions of the clipboard viewer's client area.

Remarks

When the clipboard viewer window is about to be destroyed or resized, a WM_SIZECLIPBOARD message is sent with a null rectangle (0, 0, 0, 0) as the new size. This permits the clipboard owner to free its display resources.

The clipboard owner must use the GlobalLock function to lock the memory object that contains RECT. Before returning, the clipboard owner must unlock the object by using the GlobalUnlock function.

See Also

GlobalLock, GlobalUnlock , RECT


 WM_SIZING

The WM_SIZING message is sent to a window that the user is resizing. By processing this message, an application can monitor the size and position of the drag rectangle and, if needed, change its size or position.

fwSide = wParam; // edge of window being sized

lprc = (LPRECT) lParam; // screen coordinates of drag rectangle

Parameters

fwSide

Value of wParam. Indicates which edge of the window is being sized. This parameter can be a combination of the following values:

Value | Meaning
WMSZ_BOTTOM | Bottom edge
WMSZ_BOTTOMLEFT | Bottom-left corner
WMSZ_BOTTOMRIGHT | Bottom-right corner
WMSZ_LEFT | Left edge
WMSZ_RIGHT | Right edge
WMSZ_TOP | Top edge
WMSZ_TOPLEFT | Top-left corner
WMSZ_TOPRIGHT | Top-right corner

lprc

Address of a RECT structure with the screen coordinates of the drag rectangle. To change the size or position of the drag rectangle, an application must change the members of this structure.

Return Values

An application should return TRUE if it processes this message.

See Also

RECT, WM_MOVING, WM_SIZE


 WM_SPOOLERSTATUS

The WM_SPOOLERSTATUS message is sent from Windows Print Manager whenever a job is added to or removed from the Print Manager queue.

WM_SPOOLERSTATUS

fwJobStatus = wParam; // job-status flag

cJobsLeft = LOWORD(lParam); // number of jobs remaining

Parameters

fwJobStatus

Value of wParam. Specifies the PR_JOBSTATUS flag.

cJobsLeft

Value of the low-order word of lParam. Specifies the number of jobs remaining in the Print Manager queue.

Return Values

An application should return zero if it processes this message.

Remarks

This message is for informational purposes only.


 WM_STYLECHANGED

The WM_STYLECHANGED message is sent to a window after the SetWindowLong function has changed one or more of the window's styles.

WM_STYLECHANGED

wStyleType = wParam; // extended or nonextended styles

lpss = (LPSTYLESTRUCT) lParam; // structure containing new styles

Parameters

wStyleType

Value of wParam. Specifies whether the window's extended or nonextended styles have changed. This parameter can be a combination of the following values:

Value | Meaning
GWL_EXSTYLE | The window's extended styles have changed.
GWL_STYLE | The window's nonextended styles have changed.

lpss

Value of lParam. Points to a STYLESTRUCT structure that contains the new styles for the window. An application can examine the styles, but can not change them.

Return Values

An application should return zero if it processes this message.

See Also

SetWindowLong, STYLESTRUCT , WM_STYLECHANGING


 WM_STYLECHANGING

The WM_STYLECHANGING message is sent to a window when the SetWindowLong function is about to change one or more of the window's styles.

WM_STYLECHANGING

wStyleType = wParam; // extended or nonextended styles

lpss = (LPSTYLESTRUCT) lParam; // structure containing new styles

Parameters

wStyleType

Value of wParam. Specifies whether the window's extended or nonextended styles have changed. This parameter can be a combination of the following values:

Value | Meaning
GWL_EXSTYLE | The window's extended styles are changing.
GWL_STYLE | The window's nonextended styles are changing.

lpss

Value of lParam. Points to a STYLESTRUCT structure that contains the proposed new styles for the window. An application can examine the styles and, if necessary, change them.

Return Values

An application should return zero if it processes this message.

See Also

STYLESTRUCT, WM_STYLECHANGED


 WM_SYSCHAR

The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. It specifies the character code of a system character key [image] that is, a character key that is pressed while the ALT key is down.

WM_SYSCHAR

chCharCode = (TCHAR) wParam; // character code

lKeyData = lParam; // key data

Parameters

chCharCode

Value of wParam. Specifies the character code of the window menu key.

lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value | Meaning
0 [image] 15 | Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key.
16 [image] 23 | Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 | Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25 [image] 28 | Reserved; do not use.
29 | Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.
30 | Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 | Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

Return Values

An application should return zero if it processes this message.

Remarks

When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a standard key message instead of a system character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; the PRINT SCRN key; the BREAK key; the NUMLOCK key; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

See Also

TranslateAccelerator, TranslateMessage , WM_SYSKEYDOWN


 WM_SYSCOLORCHANGE

The WM_SYSCOLORCHANGE message is sent to all top-level windows when a change is made to a system color setting.

WM_SYSCOLORCHANGE

Parameters

This message has no parameters.

Remarks

Windows sends a WM_PAINT message to any window that is affected by a system color change.

Applications that have brushes using the existing system colors should delete those brushes and recreate them using the new system colors.

Top level windows that use common controls must forward the WM_SYSCOLORCHANGE message to the controls; otherwise, the controls will not be notified of the color change. This ensures that the colors used by your common controls are consistent with those used by other user interface objects. For example, a toolbar control uses the "3D Objects" color to draw its buttons. If the user changes the 3D Objects color but the WM_SYSCOLORCHANGE message is not forwarded to the toolbar, the toolbar buttons will remain in their original color while the color of other buttons in the system changes.

See Also

WM_PAINT


 WM_SYSCOMMAND

A window receives this message when the user chooses a command from the window menu (also known as the System menu or Control menu) or when the user chooses the Maximize button or Minimize button.

WM_SYSCOMMAND

uCmdType = wParam; // type of system command requested

xPos = LOWORD(lParam); // horizontal postion, in screen coordinates

yPos = HIWORD(lParam); // vertical postion, in screen coordinates

Parameters

uCmdType

Specifies the type of system command requested. This can be one of these values:

Value | Meaning
SC_CLOSE | Closes the window.
SC_CONTEXTHELP | Changes the cursor to a question mark with a pointer. If the user then clicks a control in the dialog box, the control receives a WM_HELP message.
SC_DEFAULT | Selects the default item; the user double-clicked the window menu.
SC_HOTKEY | Activates the window associated with the application-specified hot key. The low-order word of lParam identifies the window to activate.
SC_HSCROLL | Scrolls horizontally.
SC_KEYMENU | Retrieves the window menu as a result of a keystroke.
SC_MAXIMIZE (or SC_ZOOM) | Maximizes the window.
SC_MINIMIZE (or SC_ICON) | Minimizes the window.
SC_MONITORPOWER | Windows 95 only: Sets the state of the display. This command supports devices that have power-saving features, such as a battery-powered personal computer.
SC_MOUSEMENU | Retrieves the window menu as a result of a mouse click.
SC_MOVE | Moves the window.
SC_NEXTWINDOW | Moves to the next window.
SC_PREVWINDOW | Moves to the previous window.
SC_RESTORE | Restores the window to its normal position and size.
SC_SCREENSAVE | Executes the screen saver application specified in the [boot] section of the SYSTEM.INI file.
SC_SIZE | Sizes the window.
SC_TASKLIST | Executes or activates Windows Task Manager.
SC_VSCROLL | Scrolls vertically.

xPos

Specifies the horizontal position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. Otherwise, the xPos parameter is not used.

yPos

Specifies the vertical position of the cursor, in screen coordinates, if a window menu command is chosen with the mouse. This parameter is [image] 1 if the command is chosen using a system accelerator, or zero if using a mnenomic.

Return Values

An application should return zero if it processes this message.

Remarks

The DefWindowProc function carries out the window menu request for the predefined actions specified in the previous table.

In WM_SYSCOMMAND messages, the four low-order bits of the uCmdType parameter are used internally by Windows. To obtain the correct result when testing the value of uCmdType, an application must combine the value 0xFFF0 with the uCmdType value by using the bitwise AND operator.

The menu items in a window menu can be modified by using the GetSystemMenu , AppendMenu , InsertMenu , ModifyMenu , InsertMenuItem, and SetMenuItem functions. Applications that modify the window menu must process WM_SYSCOMMAND messages.

An application can carry out any system command at any time by passing a WM_SYSCOMMAND message to DefWindowProc. Any WM_SYSCOMMAND messages not handled by the application must be passed to DefWindowProc. Any command values added by an application must be processed by the application and cannot be passed to DefWindowProc.

Accelerator keys that are defined to choose items from the window menu are translated into WM_SYSCOMMAND messages; all other accelerator keystrokes are translated into WM_COMMAND messages.

See Also

AppendMenu, DefWindowProc , GetSystemMenu , InsertMenu , ModifyMenu , WM_COMMAND


 WM_SYSDEADCHAR

The WM_SYSDEADCHAR message is sent to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by the TranslateMessage function. WM_SYSDEADCHAR specifies the character code of a system dead key [image] that is, a dead key that is pressed while holding down the ALT key.

WM_SYSDEADCHAR

chCharCode = (TCHAR) wParam; // character code

lKeyData = lParam; // key data

Parameters

chCharCode

Value of wParam. Specifies the character code generated by the system dead key [image] that is, a dead key that is pressed while holding down the ALT key.

lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value | Description
0 [image] 15 | Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key.
16 [image] 23 | Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 | Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25 [image] 28 | Reserved; do not use.
29 | Specifies the context code. The value is 1 if the ALT key is held down while the key is pressed; otherwise, the value is 0.
30 | Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 | Specifies the transition state. The value is 1 if the key is being released, or it is 0 if the key is being pressed.

Return Values

An application should return zero if it processes this message.

Remarks

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

See Also

TranslateMessage, WM_DEADCHAR, WM_SYSKEYDOWN


 WM_SYSKEYDOWN

The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user holds down the ALT key and then presses another key. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lKeyData parameter.

WM_SYSKEYDOWN

nVirtKey = (int) wParam; // virtual-key code

lKeyData = lParam; // key data

Parameters

nVirtKey

Value of wParam. Specifies the virtual-key code of the key being pressed.

lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value | Description
0 [image] 15 | Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key.
16 [image] 23 | Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 | Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25 [image] 28 | Reserved; do not use.
29 | Specifies the context code. The value is 1 if the ALT key is down while the key is pressed; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus.
30 | Specifies the previous key state. The value is 1 if the key is down before the message is sent, or it is 0 if the key is up.
31 | Specifies the transition state. The value is always 0 for a WM_SYSKEYDOWN message.

Return Values

An application should return zero if it processes this message.

Default Action

The DefWindowProc function examines the given key and generates a WM_SYSCOMMAND message if the key is either TAB or ENTER.

Remarks

When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a system character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus.

Because of automatic repeat, more than one WM_SYSKEYDOWN message may occur before a WM_SYSKEYUP message is sent. The previous key state (bit 30) can be used to determine whether the WM_SYSKEYDOWN message indicates the first down transition or a repeated down transition.

For enhanced 101- and 102-key keyboards, enhanced keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lParam parameter.

See Also

DefWindowProc, TranslateAccelerator , WM_SYSCOMMAND, WM_SYSKEYUP


 WM_SYSKEYUP

The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these two contexts by checking the context code in the lKeyData parameter.

WM_SYSKEYUP

nVirtKey = (int) wParam; // virtual-key code

lKeyData = lParam; // key data

Parameters

nVirtKey

Value of wParam. Specifies the virtual-key code of the key being released.

lKeyData

Value of lParam. Specifies the repeat count, scan code, extended-key flag, context code, previous key-state flag, and transition-state flag, as shown in the following table:

Value | Description
0 [image] 15 | Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key. The repeat count is always one for a WM_SYSKEYUP message.
16 [image] 23 | Specifies the scan code. The value depends on the original equipment manufacturer (OEM).
24 | Specifies whether the key is an extended key, such as the right-hand ALT and CTRL keys that appear on an enhanced 101- or 102-key keyboard. The value is 1 if it is an extended key; otherwise, it is 0.
25 [image] 28 | Reserved; do not use.
29 | Specifies the context code. The value is 1 if the ALT key is down while the key is released; it is 0 if the WM_SYSKEYDOWN message is posted to the active window because no window has the keyboard focus.
30 | Specifies the previous key state. The value is always 1 for a WM_SYSKEYUP message.
31 | Specifies the transition state. The value is always 1 for a WM_SYSKEYUP message.

Return Values

An application should return zero if it processes this message.

Default Action

The DefWindowProc function sends a WM_SYSCOMMAND message to the top-level window if the F10 key or the ALT key was released. The wParam parameter of the message is set to SC_KEYMENU.

Remarks

When the context code is zero, the message can be passed to the TranslateAccelerator function, which will handle it as though it were a normal key message instead of a system character-key message. This allows accelerator keys to be used with the active window even if the active window does not have the keyboard focus.

For enhanced 101- and 102-key keyboards, extended keys are the right ALT and CTRL keys on the main section of the keyboard; the INS, DEL, HOME, END, PAGE UP, PAGE DOWN and arrow keys in the clusters to the left of the numeric keypad; and the divide (/) and ENTER keys in the numeric keypad. Other keyboards may support the extended-key bit in the lKeyData parameter.

For non-U.S. enhanced 102-key keyboards, the right ALT key is handled as a CTRL+ALT key. The following table shows the sequence of messages that result when the user presses and releases this key:

Message | Virtual-key code
WM_KEYDOWN | VK_CONTROL
WM_KEYDOWN | VK_MENU
WM_KEYUP | VK_CONTROL
WM_SYSKEYUP | VK_MENU

See Also

DefWindowProc, TranslateAccelerator , WM_SYSCOMMAND, WM_SYSKEYDOWN


 WM_TCARD

The WM_TCARD message is sent to an application that has initiated a training card with Windows Help. The message informs the application when the user clicks an authorable button. An application initiates a training card by specifying the HELP_TCARD command in a call to the WinHelp function.

WM_TCARD

idAction = wParam;

dwActionData = lParam;

Parameters

idAction

Value of wParam. Indicates the action the user has taken. This parameter can be one of these values:

Value | Meaning
IDABORT | The user clicked an authorable Abort button.
IDCANCEL | The user clicked an authorable Cancel button.
IDCLOSE | The user closed the training card.
IDHELP | The user clicked an authorable Windows Help button.
IDIGNORE | The user clicked an authorable Ignore button.
IDOK | The user clicked an authorable OK button.
IDNO | The user clicked an authorable No button.
IDRETRY | The user clicked an authorable Retry button.
HELP_TCARD_DATA | The user clicked an authorable button. The lParam parameter contains a long integer specified by the help author.
HELP_TCARD_NEXT | The user clicked an authorable Next button.
HELP_TCARD_OTHER_CALLER | Another application has requested training cards.
IDYES | The user clicked an authorable Yes button.

dwActionData

Value of lParam. If idAction specifies HELP_TCARD_DATA, this parameter is a long integer specified by the help author. Otherwise, this parameter is zero.

Return Values

The return value is ignored; use zero.

See Also

WinHelp


 WM_TIMECHANGE

An application sends the WM_TIMECHANGE message to all top-level windows after changing the system time.

WM_TIMECHANGE

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Parameters

This message has no parameters.

Return Values

An application should return zero if it processes this message.

Remarks

An application that changes the system time should send this message to all top-level windows. To send the WM_TIMECHANGE message to all top-level windows, an application can use the SendMessage function with the hwnd parameter set to HWND_TOPMOST.

See Also

SendMessage


 WM_TIMER

The WM_TIMER message is posted to the installing thread's message queue or sent to the appropriate TimerProc callback function after each interval specified in the SetTimer function used to install a timer.

WM_TIMER

wTimerID = wParam; // timer identifier

tmprc = (TIMERPROC *) lParam; // address of timer callback

Parameters

wTimerID

Value of wParam. Specifies the timer identifier.

tmprc

Value of lParam. Points to an application-defined callback function that was passed to the SetTimer function when the timer was installed. If the tmprc parameter is not NULL, Windows passes the WM_TIMER message to the specified callback function rather than posting the message to the thread's message queue.

Return Values

An application should return zero if it processes this message.

Remarks

The DispatchMessage function forwards this message when no other messages are in the thread's message queue.

See Also

DispatchMessage, SetTimer , TimerProc


 WM_UNDO

An application sends a WM_UNDO message to an edit control to undo the last operation. When this message is sent to an edit control, the previously deleted text is restored or the previously added text is deleted.

WM_UNDO

wParam = 0; // not used; must be zero

lParam = 0; // not used; must be zero

Parameters

This message has no parameters.

Return Values

If the message succeeds, the return value is TRUE; otherwise, it is FALSE.

See Also

WM_CLEAR, WM_COPY, WM_CUT, WM_PASTE


 WM_USER

The WM_USER constant is used by applications to help define private messages.

WM_USER

Remarks

The WM_USER constant is used to distinguish between message values that are reserved for use by Windows and values that can be used by an application to send messages within a private window class. There are five ranges of message numbers:

Range | Meaning
0 through WM_USER [image] 1 | Messages reserved for use by Windows.
WM_USER through 0x7FFF | Integer messages for use by private window classes.
0x8000 through 0xBFFF | Messages reserved for future use by Windows.
0xC000 through 0xFFFF | String messages for use by applications.
Greater than 0xFFFF | Reserved by Windows for future use.

Message numbers in the first range (0 through WM_USER [image] 1) are defined by Windows. Values in this range that are not explicitly defined are reserved for future use by Windows.

Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.

Message numbers in the third range (0x8000 through 0xBFFF) are reserved for future use by Windows.

Message numbers in the fourth range (0xC000 through 0xFFFF) are defined at run time when an application calls the RegisterWindowMessage function to retrieve a message number for a string. All applications that register the same string can use the associated message number for exchanging messages. The actual message number, however, is not a constant and cannot be assumed to be the same between different Windows sessions.

Message numbers in the fifth range (greater than 0xFFFF) are reserved for future use by Windows.

See Also

RegisterWindowMessage


 WM_USERCHANGED

The WM_USERCHANGED message is sent to all windows after the user has logged on or off. When the user logs on or off, the system updates the user-specific settings. The system sends this message immediately after updating the settings.

WM_USERCHANGED

wParam = 0; // not used, must be zero

lParam = 0; // not used, must be zero

Return Values

An application should return zero if it processes this message.


 WM_VKEYTOITEM

The WM_VKEYTOITEM message is sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message.

WM_VKEYTOITEM

  • key = LOWORD(wParam); // virtual-key code

nCaretPos = HIWORD(wParam); // caret position

hwndLB = lParam; // handle of list box

Parameters

  • key

Value of the low-order word of wParam. Specifies the virtual-key code of the key the user pressed.

nCaretPos

Value of the high-order word of wParam. Specifies the current position of the caret.

hwndLB

Value of lParam. Identifies the list box.

Return Values

The return value specifies the action that the application performed in response to the message. A return value of [image] 2 indicates that the application handled all aspects of selecting the item and requires no further action by the list box. A return value of [image] 1 indicates that the list box should perform the default action in response to the keystroke. A return value of 0 or greater specifies the index of an item in the list box and indicates that the list box should perform the default action for the keystroke on the given item.

Default Action

The DefWindowProc function returns [image] 1.

See Also

DefWindowProc, WM_CHARTOITEM, WM_KEYDOWN


 WM_VSCROLL

The WM_VSCROLL message is sent to a window when a scroll event occurs in the window's standard vertical scroll bar. This message is also sent to the owner of a vertical scroll bar control when a scroll event occurs in the control.

WM_VSCROLL

nScrollCode = (int) LOWORD(wParam); // scroll bar value

nPos = (short int) HIWORD(wParam); // scroll box position

hwndScrollBar = (HWND) lParam; // handle of scroll bar

Parameters

nScrollCode

Value of the low-order word of wParam. Specifies a scroll bar value that indicates the user's scrolling request. This parameter can be one of the following values:

Value | Meaning
SB_BOTTOM | Scrolls to the lower right.
SB_ENDSCROLL | Ends scroll.
SB_LINEDOWN | Scrolls one line down.
SB_LINEUP | Scrolls one line up.
SB_PAGEDOWN | Scrolls one page down.
SB_PAGEUP | Scrolls one page up.
SB_THUMBPOSITION | Scrolls to the absolute position. The current position is specified by the nPos parameter.
SB_THUMBTRACK | Drags scroll box to the specified position. The current position is specified by the nPos parameter.
SB_TOP | Scrolls to the upper left.

nPos

Value of the high-order word of wParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION or SB_THUMBTRACK; otherwise, nPos is not used.

hwndScrollBar

Value of lParam. Identifies the control if WM_VSCROLL is sent by a scroll bar control. If WM_VSCROLL is sent by a window's standard scroll bar, hwndScrollBar is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

The SB_THUMBTRACK notification message is typically used by applications that provide feedback as the user drags the scroll box.

If an application scrolls the content of the window, it must also reset the position of the scroll box by using the SetScrollPos function.

Note that the WM_VSCROLL message carries only 16 bits of scroll box position data. Thus, applications that rely solely on WM_VSCROLL (and WM_HSCROLL) for scroll position data have a practical maximum position value of 65,535.

However, because the SetScrollPos, SetScrollRange, GetScrollPos, and GetScrollRange functions support 32-bit scroll bar position data, there is a way to circumvent the 16-bit barrier of the WM_HSCROLL and WM_VSCROLL messages. See GetScrollPos for a description of the technique and its limits.

See Also

GetScrollPos, GetScrollRange , SetScrollPos , SetScrollRange , WM_HSCROLL


 WM_VSCROLLCLIPBOARD

The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values.

WM_VSCROLLCLIPBOARD

hwndViewer = (HWND) wParam; // handle of clipboard viewer window

nScrollCode = (int) LOWORD(lParam); // scroll bar code

nPos = (int) HIWORD(lParam); // scroll box position

Parameters

hwndViewer

Value of wParam. Identifies the clipboard viewer window.

nScrollCode

Value of the low-order word of lParam. Specifies a scroll bar event. This parameter can be one of the following values:

Value | Meaning
SB_BOTTOM | Scroll to lower right.
SB_ENDSCROLL | End scroll.
SB_LINEDOWN | Scroll one line down.
SB_LINEUP | Scroll one line up.
SB_PAGEDOWN | Scroll one page down.
SB_PAGEUP | Scroll one page up.
SB_THUMBPOSITION | Scroll to absolute position. The current position is specified by the nPos parameter.
SB_TOP | Scroll to upper left.

nPos

Value of the high-order word of lParam. Specifies the current position of the scroll box if the nScrollCode parameter is SB_THUMBPOSITION; otherwise, the nPos parameter is not used.

Return Values

If an application processes this message, it should return zero.

Remarks

The clipboard owner can use the ScrollWindow function to scroll the image in the clipboard viewer window and invalidate the appropriate region.

See Also

ScrollWindow


 WM_WINDOWPOSCHANGED

The WM_WINDOWPOSCHANGED message is sent to a window whose size, position, or place in the Z order has changed as a result of a call to the SetWindowPos function or another window-management function.

WM_WINDOWPOSCHANGED

lpwp = (LPWINDOWPOS) lParam; // points to size and position data

Parameters

lpwp

Value of lParam. Points to a WINDOWPOS structure that contains information about the window's new size and position.

Return Values

If an application processes this message, it should return zero.

Default Action

The DefWindowProc function sends the WM_SIZE and WM_MOVE messages to the window.

Remarks

The WM_SIZE and WM_MOVE messages are not sent if an application handles the WM_WINDOWPOSCHANGED message without calling DefWindowProc. It is more efficient to perform any move or size change processing during the WM_WINDOWPOSCHANGED message without calling DefWindowProc.

See Also

DefWindowProc, EndDeferWindowPos , SetWindowPos , WINDOWPOS , WM_MOVE, WM_SIZE, WM_WINDOWPOSCHANGING


 WM_WINDOWPOSCHANGING

The WM_WINDOWPOSCHANGING message is sent to a window whose size, position, or place in the Z order is about to change as a result of a call to the SetWindowPos function or another window-management function.

WM_WINDOWPOSCHANGING

lpwp = (LPWINDOWPOS) lParam; // points to size and position data

Parameters

lpwp

Value of lParam. Points to a WINDOWPOS structure that contains information about the window's new size and position.

Return Values

If an application processes this message, it should return zero.

Default Action

For a window with the WS_OVERLAPPED or WS_THICKFRAME style, the DefWindowProc function sends the WM_GETMINMAXINFO message to the window. This is done to validate the new size and position of the window and to enforce the CS_BYTEALIGNCLIENT and CS_BYTEALIGNWINDOW client styles. By not passing the WM_WINDOWPOSCHANGING message to the DefWindowProc function, an application can override these defaults.

Remarks

While this message is being processed, modifying any of the values in WINDOWPOS affects the window's new size, position, or place in the Z order. An application can prevent changes to the window by setting or clearing the appropriate bits in the flags member of WINDOWPOS.

See Also

DefWindowProc, EndDeferWindowPos , SetWindowPos , WINDOWPOS , WM_GETMINMAXINFO, WM_MOVE, WM_SIZE, WM_WINDOWPOSCHANGED


 WM_WININICHANGE

The WM_WININICHANGE is obsolete. It is included for compatibility with earlier versions of Windows. New applications should use the WM_SETTINGCHANGE message.


principal

Messages windows

Une fois le contrôle windows sélectionné par le biais de son handle, vous pouvez lui envoyer n'importe quel message Windows. Pour connaître la signification d'un message, reportez vous à l'index de cette aide.

Dans l'exemple ci-dessous, le texte "toto" est affecté (WM_SETTEXT) au bouton "démarrer" de windows. Pour ce message, le premier paramètre (WParam) doit rester à 0, tandis que le deuxième (LParam) pointe la zone mémoire contenant le texte

Une fois la touche send pressée, on obtient :