Solved

CListbox::SetItemData/SetItemDataPtr

Posted on 1998-12-09
1
850 Views
Last Modified: 2013-11-20
If I need to associate a CObject derived class pointer with a CCheckListBox line, which function should I use - SetItemData (w/appropriate cast) or SetItemDataPtr ? The documentation seems to indicate that SetItemDataPtr actually points to the listbox entry itself (possibly for owner draw?)
0
Comment
Question by:xn12z9i
1 Comment
 

Accepted Solution

by:
McCreary earned 50 total points
Comment Utility
I have used both from time to time.   Both of these are just a way for you to associate data with the item in a CListBox. (CCheckListBox is inheirated  from CListBox I think)  The SetItemDataPtr is probably "best" simply because it is a pointer rather than a long integer and the cast is safer.

As an additional note, I have encountered more than one programmer getting memory for the CObject (or whatever) class, assigning it to the SetItemDataPtr, and then forgetting to delete the instances when the dialog holding the CListBox closes.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

763 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

16 Experts available now in Live!

Get 1:1 Help Now