Thank you guys, let me look into it more deeply. I hope I can find where the problem is occuring exactly.
so far, I have tracked down the location when it crashed..
Code:
char *todayitem[100]; //this is a variable inside the class.
void CMAININTERFACE::add_todayitem(int r, int t){
LVITEM *lvi=new LVITEM();
for(int i = 0; i<r; i++)
{
lvi->mask = LVIF_TEXT;
lvi->iItem = i;
lvi->iSubItem = 0;
if(t==0)lvi->pszText = "Task";
if(t==1)lvi->pszText = "Event";
m_dlg_list.InsertItem(lvi);
lvi->iSubItem =1;
lvi->pszText = todayitem[i];
m_dlg_list.SetItem(lvi);
lvi- pszText = id[i];
lvi->iSubItem =2;
m_dlg_list.SetItem(lvi);//this is the location where it crashes.
}
delete lvi;
}