XP下用VC开发的程序,在一个主线程调用3 个线程,线程之间要共享数据,结果总出现wincore.cpp line 980 ASSERT(pMap->LookupPermanent(hWndOrig)   ==   NULL)错误,不知该怎么办,请高手指点!

解决方案 »

  1.   

    我所有线程都使用工作线程,现在我胡View->Debug Windows->Call Stack跟踪后出现以下信息:memcpy( unsigned char * 0x01550074, unsigned char * 0x01579d24,unsigned long 4277075695) line 171
    CString::CopyBeforeWrite() line190+30 bytes
    CString::SetAt(int 42732,char 58) line 607
    TranslateCodeThread(void * 0x00fe0040) line 95
    _AfxThreadEntry(void * 0x0012f888) line112+13 bytes
    threadstartex(void * 0x00cb2070) line212+13 bytes
    KERNEL32!7c80b683()光标出现在以下位置:
    0042DF23
      

  2.   

    因误操作以上问题没有写完:
    光标出现在以下位置:
    0042df23  rep movs dword ptr [edi],dword ptr [esi]
      

  3.   

    比如说CButton或者CDialog派生出来的类
      

  4.   

    是的,用CFormView中CListBox,那怎么改?
    现在出现以下错误:
    _free_dbg_lk(void * 0x00ca9fa0, int 1) line 1033 + 60 bytes
    _free_dbg(void * 0x00ca9fa0, int 1) line 970 + 13 bytes
    operator delete(void * 0x00ca9fa0) line 351 + 11 bytes
    CString::FreeData() line 146 + 15 bytes
    CString::Release() line 157
    CString::operator=(const CString & {"GS0C4,GPSVST,07,{02,55,308,{44,00,00},00},{13,27,077,{39,00,00},00},{04,56,038,{45,00,00},00},{10,39,216,{38,00,00},00},{17,35,126,{42,00,00},00},{30,14,314,{39,00,00},00},{05,28,293,{38,00,00},00},@40
    $GNZDA,023901.00,28,03,2007,00,00*7D
    GS0C4,GPSVS") line 334
    TranslateCodeThread(void * 0x00fe0040) line 54
    _AfxThreadEntry(void * 0x0012f888) line 112 + 13 bytes
    _threadstartex(void * 0x00cb2070) line 212 + 13 bytes
    KERNEL32! 7c80b683()
      

  5.   

    先说一下可能的原因
    1。线程中使用了指向全局的DoModal对话框类,并在线程中试图销毁对话框对象,有可能导致,最好改成局部的。如果是派生类,在析构函数里设置m_hWnd=NULL;不知道你是怎样引用的CListBox,你可以贴出相关代码。线程里最好不要直接使用指针,可以把这些类的hwnd句柄传递进去,或者使用postmessage来与UI交互
      

  6.   

    我的视是基于CFormView,没有可析构函数
    在class CJavadView : public CFormView中定义
    CGCColorStatic m_GPSTime;
    CListBox m_ListTTS;
    CString FileHeader[19];
    在线程中使用
    UINT TranslateCodeThread(LPVOID pParam)
    {
    CJavadView *pView;
    pView=(CJavadView*)pParam; CString GPSStr,weekstr;
    GPSStr.Format(" %02d : %02d : %02d",hour,minute,second);
    pView->m_GPSTime.SetWindowText(GPSStr);
    for(i=0;i<19;i++)
    pView->m_ListTTS.AddString(pView->FileHeader[i])
    }
      

  7.   

    还出现以下错误:
    Debug Error!DAMAGE: after Normal block(#789630) at 0x00CA9FA0