I am displaying a ListView cntrl in a modal Dialog box, with ListView properties as “Owner Draw” and “Owner Draw fixed” and using LVN_GETDISPINFO. The dialog along with the list view is getting displayed when there is no data. But strangely, when I am trying to insert data into the list view (by putting data in the array (vector) attached with the list view), my dialog is crashing.
On debugging, the error seems to be coming from the following MFC Library function :
void CListCtrl::DrawItem(LPDRAWITEMSTRUCT)
{
ASSERT(FALSE);
}
In my other applications I have successfully displayed a list control (with Owner draw and Owner data), without subclassing CListCtrl, and overidding DrawItem(). But in my present dialog, I am unable to understand why the list view is failing when I am inserting data into it?
Appreciate your time and help.
Thanks
when you define Owner Draw property, you must implement your own DrawItem function witch draw one item.
You can look for this article