Solved

CListbox::SetItemData/SetItemDataPtr

Posted on 1998-12-09
1
874 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
ID: 1325956
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

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. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

773 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