在线求助???为什么有内存溢出
void CMouseMoveTestView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
#ifdef _DEBUG
CMemoryState oldMemState,
newMemState, diffMemState;
oldMemState.Checkpoint();
#endif
//Set Coord Panel
CPoint pt = point;
/* CClientDC dc(this);
OnPrepareDC(&dc);
dc.DPtoLP( &pt );*/
//!下面是一个错误!???????????????????????????????????
CMainFrame* pMainFrame = (CMainFrame*) AfxGetMainWnd();
// pMainFrame->SetCoordPanel( ptLP );
// pMainFrame->SetCoordPanel( pt );
int id = pMainFrame->m_wndStatusBar.CommandToIndex( ID_COORDPANEL );
if(id<0)
AfxMessageBox("asd");
CString m_strCoord;
m_strCoord.Format( "%d, %d", pt.x, pt.y );
//!这句话有内存溢出
pMainFrame->m_wndStatusBar.SetPaneText( id, m_strCoord);
#ifdef _DEBUG
newMemState.Checkpoint();
if(diffMemState.Difference(oldMemState, newMemState)) {
TRACE("Difference between first and now!\n\n");
diffMemState.DumpStatistics();
ASSERT(FALSE);
}
#endif
CView::OnMouseMove(nFlags, point);
}