Solved

CListbox::SetItemData/SetItemDataPtr

Posted on 1998-12-09
1
917 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

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

634 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