WM_MEASUREITEM

WM_MEASUREITEM

lpmis = (LPMEASUREITEMSTRUCT) lParam; /* item-size information */

The WM_MEASUREITEM message is sent to the owner window of an owner-draw button, combo box, list box, or menu item when the control or menu is created. When the owner window receives the message, the owner fills in the MEASUREITEMSTRUCT structure pointed to by the lParam message parameter 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.

Parameters

lpmis

Value of lParam. Points to a MEASUREITEMSTRUCT structure that contains the dimensions of the owner-draw control or menu item. The MEASUREITEMSTRUCT structure has the following form:

typedef struct tagMEASUREITEMSTRUCT { /* mis */

UINT CtlType;

UINT CtlID;

UINT itemID;

UINT itemWidth;

UINT itemHeight;

DWORD itemData;

} MEASUREITEMSTRUCT;

Return Value

An application should return TRUE if it processes this message.

Comments

Windows sends the WM_MEASUREITEM message to the owner window of combo boxes and list boxes created with the OWNERDRAWFIXED style before sending WM_INITDIALOG. 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

WM_INITDIALOG