I have used CListCtrl in the past with no problem, but in my current project I get an access violation.
I have traced it down to the face that the m_hWnd in not set. Trying to set it also results in an access violation.
I am able to create the column headers with no problem. It is when I perform an InsertItem that the error occurs. I have compared my implementation with what I had done in my previous project and it all looks the same.
Code:
m_PayoutSheet.SetExtendedStyle(m_PayoutSheet.GetExtendedStyle()|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS|LVS_EX_GRIDLINES);
m_PayoutSheet.InsertColumn(0,"Place",LVCFMT_LEFT,40,-1);
m_PayoutSheet.InsertColumn(1,"Percentage",LVCFMT_LEFT,80,-1);
m_PayoutSheet.InsertColumn(2,"Prize",LVCFMT_LEFT,50,-1);
char PlaceT[255];
char PercentageT[255];
sprintf(PlaceT,"%d",Place);
sprintf(PercentageT,"%d",Percentage);
m_PayoutSheet.InsertItem(0,PlaceT);
// Insert subitem for col 1
m_PayoutSheet.SetItemText(1, 1, PercentageT);