CImageList exception in MFC programming VS-2008
I'm following example 8a of a MFC book entitled (Programming with Microsoft Visual C++ .NET, Sixth Edition).
However when I tried to compile it I faced with the following exceptions:
Unhandled exception at 0x78a782ac (mfc90ud.dll) in Ex08a.exe:
0xC0000005: Access violation reading location 0x00000020.
which points to
{
ASSERT(::I开发者_开发百科sWindow(m_hWnd));
return CImageList::FromHandle((HIMAGELIST)::SendMessage(m_hWnd, LVM_SETIMAGELIST,
nImageList, (LPARAM)pImageList->GetSafeHandle()));
}
in afxcmn.inl
Since I'm using visual studio 2008, there are differences between my code and Book's code.
The following lines are some of those discrepancies:
ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST1, &CEx08aDialog::OnLvnItemChangedListview1)
ON_NOTIFY(TVN_SELCHANGED, IDC_TREEVIEW1, &CEx08aDialog::OnTvnSelchangedTreeview1)
static char* color[]={"white","black","red","blue","yellow","cyan","purple","green"};
pList->InsertItem(n,(LPCTSTR)color[n],n);
Any comment is welcome.
精彩评论