msgs12.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WM_DRAWITEM (1.2)
Changes                                             Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINMESSAGEMGR
 
WM_DRAWITEM
id = (USHORT) SHORT1FROMMP(mp1);        /* window ID             */
poi = (POWNERITEM) PVOIDFROMMP(mp2);    /* pointer to OWNERITEM  */
 
The WM_DRAWITEM message is sent to the owner of a list box when an item in
an owner-drawn list needs to be drawn or highlighted. The list box must have
the LS_OWNERDRAW style. The WM_DRAWITEM message is also sent to the owner of
a menu when an item in the owner-drawn menu needs to be drawn or
highlighted. The menu must have the MIS_OWNERDRAW style.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
id         Low word of mp1. Identifies the window of the list-box or menu
           control sending this message.
 
poi        Low and high word of mp2. Points to an OWNERITEM structure.
 
Return Value
 
The application should return TRUE if it draws the list-box item; it should
return FALSE if the list box should draw the item. If the WM_DRAWITEM
message is sent to a menu, the return value is ignored.
 
Comments
 
When an item is to be drawn, the fsState field and the fsStateOld field of
the OWNERITEM structure will be equal. The application should draw the item
and return TRUE, or it should return FALSE to let the list box draw the
item. The list box can draw only text items, so the application must handle
the drawing of other types of objects.
 
When an item is to be highlighted, the fsState field is TRUE and the
fsStateOld field is FALSE. In this case, the application should carry out
the highlighting and set fsState and fsStateOld equal to FALSE before
returning TRUE, or it should return FALSE so the list box can perform
default highlighting of the item.
 
When highlighting is to be removed from an item, the fsState field is FALSE
and the fsStateOld field is TRUE. An application can remove the
highlighting, set the fsState and fsStateOld equal to FALSE and return TRUE,
or it can return FALSE to let the list box remove the highlighting.
 
See Also
 
LM_QUERYITEMTEXT, OWNERITEM