Solved

Catching WM_DRAWITEM

Posted on 1998-07-02
3
878 Views
Last Modified: 2008-03-04
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?
0
Comment
Question by:joeslow
  • 2
3 Comments
 
LVL 8

Accepted Solution

by:
trestan earned 50 total points
ID: 1167068
You have to go to class info tab in class wizard and change the message filter comboBox and set the option as window. Then you will find what you want.
0
 

Author Comment

by:joeslow
ID: 1167069
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.
0
 
LVL 8

Expert Comment

by:trestan
ID: 1167070
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
 

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now