Sometime you use CListView and need to extend the functionality of the CListCtrl of the view. For example, you want to overwrite the handler function of the NM_CUSTOMDRAW or WM_SIZE message. So the problem is: How to tell CListView to use your own CListCtrl?
OK, you are on the wrong way now.
The CListView does not use or contain the MFC CListCtrl, it only wraps a subclassed SysListView32 control as a CCtrlView, in the other hand, the view is the control.
If all you’ve done in your custom CListCtrl derived class is to handle the reflected NM_CUSTOMDRAW message, your best bet to get this working as a custom CListView is to derive a class from CListView and handle the reflected message for it just as you do in your CListCtrl derived implementation.
If you want get more custom control or you have already make an extended version of CList, It may be easier to derive a view class from CView and use your own CListCtrl in the view.
There are two articles about this topic on CodeGuru:
Permalink: Code Library - How to use an derived CListCtrl in CListView
Subcribe the update with Google Reader.
2 Responses
How do I subclass the CListCtrl part of a CListView Class? | CodeLibrary
October 22nd, 2007 at 2:49 pm
1[...] How to use an derived CListCtrl in CListView Tags: CListCtrl, CListView, Howto, Subclass [...]
How to subclass CTreeCtrl in CTreeView? | CodeLibrary
October 25th, 2007 at 11:16 am
2[...] is similar with this article: “How to use an derived CListCtrl in CListView” or “How do I subclass the CListCtrl part of a CListView [...]
RSS feed for comments on this post · TrackBack URI
Leave a reply
Category
Recent Posts
Hot Posts
Creative Commons
Code Library