I am using MFC in Visual Studio 2005.
I had added a list control in my dialog and set the view property as "Icon". I declared the ImageList in the OnInitDialog of the dialog where the listview is displayed. The dialog is supposed to open when I clicked a button from the main dialog. However, I keep on getting this problem which I guess is due to the hWnd = 0x00000000.
m_ListView {CListCtrl hWnd=0x00000000 } CListCtrl
Part of my code:
BOOL CSoccerControl: :OnInitDialog()
{
CDialog::OnInit Dialog();
.
.
.
m_pImageList = new CImageList(); //I had declared m_pImageList in the header file using CImageList *m_pImageList;
//Create, initialize, and hook up image list
m_pImageList->Create(32,32,T RUE,1,1);
m_pImageList->Add(AfxGetApp( )->LoadIconA(IDI_ TEST));
this->m_ListView.Set ImageList(m_pIm ageList, LVSIL_NORMAL);
return TRUE;
}
Compiler shows problem occurs here:
{ ASSERT(::IsWind ow(m_hWnd)); return CImageList::Fro mHandle((HIMAGE LIST)
::SendMessage(m _hWnd, LVM_SETIMAGELIS T, nImageList, (LPARAM)pImageL ist->GetSafeHandle( ))); }
From the call stack:
mfc80d.dll!CLis tCtrl::SetImage List(CImageList * pImageList=0x00 35b250, int nImageList=0) Line 138 + 0x2b bytes C++
Humanoid_GUI.ex e!CSoccerContro l::OnInitDialog () Line 136 C++
mfc80d.dll!AfxD lgProc(HWND__ * hWnd=0x000e0218 , unsigned int message=272, unsigned int __formal=786840 , unsigned int __formal=786840 ) Line 28 + 0x10 bytes C++
user32.dll!7e41 8734()
[Frames below may be incorrect and/or missing, no symbols loaded for user32.dll]
user32.dll!7e42 3b9c()
user32.dll!7e42 3591()
user32.dll!7e43 e53f()
user32.dll!7e41 84fc()
user32.dll!7e41 85a4()
user32.dll!7e43 e561()
user32.dll!7e41 8734()
user32.dll!7e43 e53f()
user32.dll!7e43 e53f()
user32.dll!7e41 8816()
user32.dll!7e43 e53f()
user32.dll!7e43 e53f()
ntdll.dll!7c912 c99()
user32.dll!7e41 c63f()
user32.dll!7e43 e53f()
user32.dll!7e41 f65d()
user32.dll!7e43 e53f()
mfc80d.dll!CWnd ::DefWindowProc A(unsigned int nMsg=272, unsigned int wParam=786840, long lParam=0) Line 1029 + 0x20 bytes C++
mfc80d.dll!CWnd ::Default() Line 274 C++
mfc80d.dll!CDia log::HandleInit Dialog(unsigned int __formal=786840 , unsigned int __formal=786840 ) Line 633 + 0x8 bytes C++
mfc80d.dll!CWnd ::OnWndMsg(unsi gned int message=272, unsigned int wParam=786840, long lParam=0, long * pResult=0x0012f 070) Line 2004 + 0x11 bytes C++
mfc80d.dll!CWnd ::WindowProc(un signed int message=272, unsigned int wParam=786840, long lParam=0) Line 1741 + 0x20 bytes C++
mfc80d.dll!AfxC allWndProc(CWnd * pWnd=0x0035a910 , HWND__ * hWnd=0x000e0218 , unsigned int nMsg=272, unsigned int wParam=786840, long lParam=0) Line 240 + 0x1c bytes C++
mfc80d.dll!AfxW ndProc(HWND__ * hWnd=0x000e0218 , unsigned int nMsg=272, unsigned int wParam=786840, long lParam=0) Line 389 C++
mfc80d.dll!AfxW ndProcBase(HWND __ * hWnd=0x000e0218 , unsigned int nMsg=272, unsigned int wParam=786840, long lParam=0) Line 407 + 0x15 bytes C++
user32.dll!7e41 8734()
user32.dll!7e41 8816()
user32.dll!7e41 b89b()
user32.dll!7e42 43e0()
user32.dll!7e42 4704()
user32.dll!7e43 9b0b()
mfc80d.dll!CWnd ::CreateDlgIndi rect(const DLGTEMPLATE * lpDialogTemplat e=0x00a6a160, CWnd * pParentWnd=0x00 12fe3c, HINSTANCE__ * hInst=0x0040000 0) Line 307 + 0x2a bytes C++
mfc80d.dll!CDia log::DoModal() Line 536 + 0x20 bytes C++
Humanoid_GUI.ex e!CHumanoid_GUI Dlg::OnBnClicke dButtonSoccer() Line 264 + 0x12 bytes C++
mfc80d.dll!_Afx DispatchCmdMsg( CCmdTarget * pTarget=0x0012f e3c, unsigned int nID=1006, int nCode=0, void (void)* pfn=0x00425541, void * pExtra=0x000000 00, unsigned int nSig=56, AFX_CMDHANDLERI NFO * pHandlerInfo=0x 00000000) Line 82 C++
mfc80d.dll!CCmd Target::OnCmdMs g(unsigned int nID=1006, int nCode=0, void * pExtra=0x000000 00, AFX_CMDHANDLERI NFO * pHandlerInfo=0x 00000000) Line 381 + 0x27 bytes C++
mfc80d.dll!CDia log::OnCmdMsg(u nsigned int nID=1006, int nCode=0, void * pExtra=0x000000 00, AFX_CMDHANDLERI NFO * pHandlerInfo=0x 00000000) Line 85 + 0x18 bytes C++
mfc80d.dll!CWnd ::OnCommand(uns igned int wParam=1006, long lParam=1048948) Line 2300 C++
mfc80d.dll!CWnd ::OnWndMsg(unsi gned int message=273, unsigned int wParam=1006, long lParam=1048948, long * pResult=0x0012f 800) Line 1755 + 0x1e bytes C++
mfc80d.dll!CWnd ::WindowProc(un signed int message=273, unsigned int wParam=1006, long lParam=1048948) Line 1741 + 0x20 bytes C++
mfc80d.dll!AfxC allWndProc(CWnd * pWnd=0x0012fe3c , HWND__ * hWnd=0x000e020e , unsigned int nMsg=273, unsigned int wParam=1006, long lParam=1048948) Line 240 + 0x1c bytes C++
mfc80d.dll!AfxW ndProc(HWND__ * hWnd=0x000e020e , unsigned int nMsg=273, unsigned int wParam=1006, long lParam=1048948) Line 389 C++
mfc80d.dll!AfxW ndProcBase(HWND __ * hWnd=0x000e020e , unsigned int nMsg=273, unsigned int wParam=1006, long lParam=1048948) Line 407 + 0x15 bytes C++
user32.dll!7e41 8734()
user32.dll!7e41 8816()
user32.dll!7e41 b4c0()
user32.dll!7e41 b89b()
user32.dll!7e41 b903()
user32.dll!7e44 fd1d()
user32.dll!7e44 6561()
user32.dll!7e42 6df4()
mfc80d.dll!AfxG etThread() Line 137 + 0x5 bytes C++
mfc80d.dll!CWin Thread::Process MessageFilter(i nt code=0, tagMSG * lpMsg=0x0003001 d) Line 850 + 0x5 bytes C++
00000202()
user32.dll!7e43 affe()
user32.dll!7e41 8734()
user32.dll!7e43 affe()
user32.dll!7e43 affe()
user32.dll!7e41 8816()
user32.dll!7e43 affe()
user32.dll!7e41 f805()
user32.dll!7e41 89cd()
user32.dll!7e43 affe()
user32.dll!7e43 1b3c()
user32.dll!7e41 8a10()
user32.dll!7e42 d99d()
user32.dll!7e43 c69b()
mfc80d.dll!CWnd ::IsDialogMessa geA(tagMSG * lpMsg=0x0015419 8) Line 198 C++
mfc80d.dll!CWnd ::PreTranslateI nput(tagMSG * lpMsg=0x0015419 8) Line 4268 C++
mfc80d.dll!CDia log::PreTransla teMessage(tagMS G * pMsg=0x00154198 ) Line 80 C++
mfc80d.dll!CWnd ::WalkPreTransl ateTree(HWND__ * hWndStop=0x000e 020e, tagMSG * pMsg=0x00154198 ) Line 2882 + 0x14 bytes C++
mfc80d.dll!AfxI nternalPreTrans lateMessage(tag MSG * pMsg=0x00154198 ) Line 233 + 0x12 bytes C++
mfc80d.dll!CWin Thread::PreTran slateMessage(ta gMSG * pMsg=0x00154198 ) Line 773 + 0x9 bytes C++
mfc80d.dll!AfxP reTranslateMess age(tagMSG * pMsg=0x00154198 ) Line 252 + 0x11 bytes C++
mfc80d.dll!AfxI nternalPumpMess age() Line 178 + 0x18 bytes C++
mfc80d.dll!CWin Thread::PumpMes sage() Line 896 C++
mfc80d.dll!AfxP umpMessage() Line 190 + 0xd bytes C++
mfc80d.dll!CWnd ::RunModalLoop( unsigned long dwFlags=4) Line 4322 + 0x5 bytes C++
mfc80d.dll!CDia log::DoModal() Line 544 + 0xc bytes C++
Humanoid_GUI.ex e!CHumanoid_GUI App::InitInstan ce() Line 58 + 0xb bytes C++
mfc80d.dll!AfxW inMain(HINSTANC E__ * hInstance=0x004 00000, HINSTANCE__ * hPrevInstance=0 x00000000, char * lpCmdLine=0x001 51f3f, int nCmdShow=1) Line 37 + 0xd bytes C++
Humanoid_GUI.ex e!WinMain(HINST ANCE__ * hInstance=0x004 00000, HINSTANCE__ * hPrevInstance=0 x00000000, char * lpCmdLine=0x001 51f3f, int nCmdShow=1) Line 29 C++
Humanoid_GUI.ex e!__tmainCRTSta rtup() Line 578 + 0x35 bytes C
Humanoid_GUI.ex e!WinMainCRTSta rtup() Line 403 C
kernel32.dll!7c 816fd7()
What should I do to avoid the problem?