title: Debug Assertion failed in .exe/wincore.cpp
body: <p>I am doing an RT simulator in VC++ 6.0. whenever it is executed, without the               Open Architecture Computer(OAC,it is the Bus Controller in the Flight) switched on, the program executes properly. But with the OAC ON, the program is giving Debug assertion failed- in Debug/.exe/wincore.cpp at line no. 980. what may be the problem?  Please provide with the solution if possible.</p>
  
  <p>This is the copmlete DestroyWindow function.</p>
  
  <pre><code>BOOL CWnd::DestroyWindow()
  {
      if (m_hWnd == NULL)
          return FALSE;
  
      CHandleMap* pMap = afxMapHWND();
      ASSERT(pMap != NULL);
      CWnd* pWnd = (CWnd*)pMap-&gt;LookupPermanent(m_hWnd);
  #ifdef _DEBUG
      HWND hWndOrig = m_hWnd;
  #endif
  
  #ifdef _AFX_NO_OCC_SUPPORT
      BOOL bResult = ::DestroyWindow(m_hWnd);
  #else //_AFX_NO_OCC_SUPPORT
      BOOL bResult;
      if (m_pCtrlSite == NULL)
          bResult = ::DestroyWindow(m_hWnd);
      else
          bResult = m_pCtrlSite-&gt;DestroyControl();
  #endif //_AFX_NO_OCC_SUPPORT
  
      // Note that 'this' may have been deleted at this point,
      //  (but only if pWnd != NULL)
      if (pWnd != NULL)
      {
          // Should have been detached by OnNcDestroy
  #ifdef _DEBUG
  //////////////////////////////HERE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!///////////////////
          ASSERT(pMap-&gt;LookupPermanent(hWndOrig) == NULL); //line 980
  #endif
      }
      else
      {
  #ifdef _DEBUG
          ASSERT(m_hWnd == hWndOrig);
  #endif
          // Detach after DestroyWindow called just in case
          Detach();
      }
      return bResult;
  }
  </code></pre>