Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CListbox::SetItemData/SetItemDataPtr

Posted on 1998-12-09
1
Medium Priority
?
934 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 200 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

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: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

670 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