Solved

CListbox::SetItemData/SetItemDataPtr

Posted on 1998-12-09
1
901 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
only14 challenge 19 89
pre4 challenge 19 116
JQuery serialize and unserialize 8 269
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Suggested Courses

734 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