Hi,
I'm using a virtual lit control and I get the data from a map. My problem is when I run the code, it displays the list ok, but when the mouse cursor moves on to the list control or when I try to scroll down, it gives a Debug Assertion failure saying map/set iterator is not dereferencable. My GetDispInfo() method is as follows:
void CListCtrlTestDlg::GetDispInfo(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
LV_ITEM* pItem = &(pDispInfo)->item;
map<int, Error_Struct>::iterator it = Error_Map.find((pItem->iItem) + 1);
int iErrCode = (*it).second.i_ErrorCode;
CString cError = (*it).second.c_Error;
switch(pItem->iSubItem)
{
case 0:
sprintf_s(pItem->pszText, 10, "[ %d ]", iErrCode);
break;
case 1:
sprintf_s(pItem->pszText, 100, "%s", cError);
break;
}
*pResult = 0;
}
Also if when the mouse pointer is on top of the list control, again the program crashes saying access violation from the line showed below in output.c file:
#else /* _UNICODE */
if (_putc_nolock(ch, f) == EOF)
Has anyone got the same experience? What am I doing wrong here and how can I fix this problem?
Thank You!