Re: LParam in a list control
Are you sure your DeleteAllItems() function is getting called and it's not
just calling the one in the base CListCtrl class. I think you mentioned
that you were stopping in the function, but I figured it is worth it to ask.
The DeleteAllItems() function in the CListCtrl (just looked it up) is
defined as:
_AFXCMN_INLINE BOOL CListCtrl::DeleteAllItems()
{ ASSERT(::IsWindow(m_hWnd)); return (BOOL) ::SendMessage(m_hWnd,
LVM_DELETEALLITEMS, 0, 0L); }
Which I believe ultimately ends up as a force inline function and it isn't
virtual. Maybe something is getting messed up in the linkage? I know I'm
grasping at straws, but this is a weird one. Have you tried naming the
function something else and calling that function instead?
Tom
"GT" <ContactGT_remove_@hotmail.com> wrote in message
news:45f9820c$0$32250$c3e8da3@news.astraweb.com...
"Tom Serface" <tom.nospam@camaswood.com> wrote in message
news:949C6EE3-C682-433F-99AD-90338338A6BC@microsoft.com...
You could trace through the code and keep track of the memory locations
that are added and retrieved have the same memory locations. Also you
may want to delete the memory before the list control item. I'm not sure
this would make any difference, but ... Maybe there is something wrong
with the code where you are adding (SetItemData()) the memory to the list
control?
I had the deletes the other way round to start with, I also tried not
calling DeleteItem, but instead sending the DeleteAllItems message
(commented out last line in original post). Nothing seems to work! My
SetItemData is pretty simple - I declare a new ControlItemLParam, then set
2 values, then use the ControlItemLParam pointer it as the LParam. I
retrieve and check the stored values in a few places and it all works OK.
This has got me a bit stumped!