Link to home
Start Free TrialLog in
Avatar of joeslow
joeslow

asked on

Catching WM_DRAWITEM

I have a SDI app whose view is a CTreeView.  I want to have owner drawn popup menus.  In order to do this I want to catch the WM_DRAWITEM and WM_MEASUREITEM messages.  These are not offered in class wizard for the view so I put them in by hand.  But as far as I can tell, neither of these messages are sent to the view.  Any suggestions?
ASKER CERTIFIED SOLUTION
Avatar of trestan
trestan
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of joeslow
joeslow

ASKER

Changing the filter to a Window does show the WM_DRAWITEM and WM_MEASUREITEM messages as choices now.  However, they still aren't being sent to the CTreeView.  Someone told me that those messages never get sent to a view but are "control" specific.
The follows is imformation from the online manual. I am afraid that these messages can not sent to a CTreeView.

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
*****************************************************************
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