> a quick look told me that I'm _not_ supposed to cast a function
> pointer to a void*.  This matter is more complicated than I
> thought; looks like I've got some reading to do :)

I'm sure they only say that because it then loses its C++ type information;
but as long as you cast it back to the correct type the other end when
retrieving it, it should be no problem. There's no other way I can think of
to store such information against a CListCtrl item otherwise...

Well, OK, that's not true. I guess the DWORD set into the list could be an
index into an array of pointers, e.g.:

CPtrArray       pointerArray ;  // Example only!

CSomeClass *pObject = GetThePtr();
int iArrayIndex = pointerArray.Add(pObject);
myListCtrl.SetItemData(iListIndex, iArrayIndex);

Of course, my example CPtrArray would also lose the type info on the ptr, so
you would substitute your favourite STL container or whatever.

--
Jason Teagle
[EMAIL PROTECTED]



_______________________________________________
msvc mailing list
[EMAIL PROTECTED]
See http://beginthread.com/mailman/listinfo/msvc_beginthread.com for subscription 
changes, and list archive.

Reply via email to