我的程序runningtime报错winctrl2.cpp  1202行就是这句ASSERT(m_hImageList == NULL); 请问是什么问题!! 
BOOL CImageList::Attach(HIMAGELIST hImageList)
{
ASSERT(m_hImageList == NULL);      // only attach once, detach on destroy
ASSERT(FromHandlePermanent(hImageList) == NULL); if (hImageList == NULL)
return FALSE;

解决方案 »

  1.   

    CImageList在创建时,已经有了。
    删除后,再创建
      

  2.   

    能说的明白一点码??    m_ImageList.Create(IDB_IMAGES, 16, 1, RGB(255, 0, 255));
    m_treeCtrl.SetImageList(&m_ImageList, LVSIL_NORMAL);
    用到Cimagelist 只有这两句 有问题码??
      

  3.   

    CImageList::Attach(_IMAGELIST * 0x00172688) line 1202
    CImageList::Create(unsigned int 131, int 16, int 1, unsigned long 16711935) line 1183
    CLeftPaneView::OnInitialUpdate() line 73
    CWnd::OnWndMsg(unsigned int 868, unsigned int 0, long 0, long * 0x0012fa84) line 1825
    CWnd::WindowProc(unsigned int 868, unsigned int 0, long 0) line 1585 + 30 bytes
    AfxCallWndProc(CWnd * 0x015d10a0 {CLeftPaneView hWnd=???}, HWND__ * 0x002008f4, unsigned int 868, unsigned int 0, long 0) line 215 + 26 bytes
    CWnd::SendMessageToDescendants(HWND__ * 0x001808fa, unsigned int 868, unsigned int 0, long 0, int 1, int 1) line 2309
    CWnd::SendMessageToDescendants(HWND__ * 0x001a08d2, unsigned int 868, unsigned int 0, long 0, int 1, int 1) line 2320
    CWnd::SendMessageToDescendants(unsigned int 868, unsigned int 0, long 0, int 1, int 1) line 146 + 32 bytes
    CFrameWnd::InitialUpdateFrame(CDocument * 0x015d1730 {COutLookStyleDoc}, int 1) line 749
    CDocTemplate::InitialUpdateFrame(CFrameWnd * 0x015d1460 {CMainFrame hWnd=???}, CDocument * 0x015d1730 {COutLookStyleDoc}, int 1) line 332
    CSingleDocTemplate::OpenDocumentFile(const char * 0x00000000, int 1) line 205
    CDocManager::OnFileNew() line 829
    CWinApp::OnFileNew() line 29
    _AfxDispatchCmdMsg(CCmdTarget * 0x00614d80 class COutLookStyleApp  theApp, unsigned int 57600, int 0, void (void)* 0x004bf390 CWinApp::OnFileNew(void), void * 0x00000000, unsigned int 12, AFX_CMDHANDLERINFO * 0x00000000) line 88
    CCmdTarget::OnCmdMsg(unsigned int 57600, int 0, void * 0x00000000, AFX_CMDHANDLERINFO * 0x00000000) line 302 + 39 bytes
    CWinApp::ProcessShellCommand(CCommandLineInfo & {CCommandLineInfo}) line 31 + 30 bytes
    COutLookStyleApp::InitInstance() line 117 + 15 bytes
    AfxWinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x001330f2, int 1) line 39 + 11 bytes
    WinMain(HINSTANCE__ * 0x00400000, HINSTANCE__ * 0x00000000, char * 0x001330f2, int 1) line 30
    WinMainCRTStartup() line 198 + 54 bytes
    KERNEL32! 77e77d08()上面的是callback中的显示.
      

  4.   

    ASSERT
    ASSERT( booleanExpression )ParametersbooleanExpressionSpecifies an expression (including pointer values) that evaluates to nonzero or 0.ResEvaluates its argument. If the result is 0, the macro prints a diagnostic message and aborts the program. If the condition is nonzero, it does nothing.
    运行ASSERT宏的时候,如果判断条件不成立,则程序就会出现错误,并被终止。
      

  5.   

    这是我的demo:
    SourceListImage.Create(SourceListImageWidth,SourceListImageHeight,ILC_COLORDDB,50,1000); 
    m_SourceList.SetImageList(&SourceListImage,LVSIL_NORMAL);
      

  6.   

    关键是CImageList的create只能一次