---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!Program: *********
File: winocc.cpp
Line: 290
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.(Press Retry to debug the application)
---------------------------
终止(A)   重试(R)   忽略(I)   
---------------------------

解决方案 »

  1.   

    你SetWindowPos了?在控件还没有创建成功的时候就SetWindowPos了?
      

  2.   

    在SetWindowPos之前,先判断控件的m_hWnd是否为NULL。
      

  3.   

    你原来Release的版本没问题是因为Release忽略断言。
    而Debug是会检测断言的。
      

  4.   

    我有好多个SetWindowPos,,你说的判断m_hWnd是不是只针对本单文档的视图或框架的SetWindowPos呢???
    除了本身的SetWindowPos,,另外还有好多的按钮,文本框之类的都用,,这些应该不用判断m_hWnd的吧??
      

  5.   

    应该好像在你说的问题,,但m_hWnd具体应该在哪声明呢,,
      

  6.   

    你原来Release的版本没问题是因为Release忽略断言。
    而Debug是会检测断言的。
      

  7.   

    控件都有自己的m_hWnd,如CEdit m_edit;
    你可以这样用::IsWindow(m_edit.m_hWnd)来判断
      

  8.   


    if(::IsWindow(m_MainTitle.m_hWnd))
    {
    m_MainTitle.SetWindowPos(NULL,0,0,cx,37, NULL);
    m_MainTitle.RedrawWindow();
    }m_MainTitle是CStatic的派生类.
    这样应该没错吧..可if条件竟都不能够执行了..这是怎么回事呀??
      

  9.   

    继11楼:
    m_MainTitle.RedrawWindow();冒然执行也会出错
      

  10.   

    m_hwnd是窗口的句柄
    当窗口没有建立时,m_hwnd为NULL,这时如果做某些操作(发消息、移动等),就会触发断言
      

  11.   

    用了debug,,现在又重新用Release竟然不行了..---------------------------
    Microsoft Visual C++ Debug Library
    ---------------------------
    Debug Assertion Failed!Program: D:\work\1mplayer\s1.700(0802291500)\Release\s.exe
    File: afxwin1.inl
    Line: 22For information on how your program can cause an assertion
    failure, see the Visual C++ documentation on asserts.(Press Retry to debug the application)
    ---------------------------
    终止(A)   重试(R)   忽略(I)   
    ---------------------------
      

  12.   


    ---------------------------
    Microsoft Visual C++
    ---------------------------
    Unhandled exception in s.exe (MFC42D.DLL): 0xC0000005: Access Violation.
    ---------------------------
    确定   
    ---------------------------
      

  13.   

    assert不一定是致命错误,在release版本中会去除这些测试操作,但是debug版本中就会进行测试,一遍出现这种错误,说明在程序中还是存在一些潜在的,或者无效的数据或者函数调用。