在MFC多文档多视图下开发程序,运行一会,会出现错误,调试得知在wingdi.cpp中的
int CDC::SetMapMode(int nMapMode)
{
ASSERT(m_hDC != NULL);
int nRetVal = 0; if (m_hDC != m_hAttribDC)
nRetVal = ::SetMapMode(m_hDC, nMapMode);
if (m_hAttribDC != NULL)
nRetVal = ::SetMapMode(m_hAttribDC, nMapMode);
return nRetVal;
}
这个函数中,m_hDC的值为空,但是pDC的值不为空,我刚开始学,不太懂,请各位高手帮忙看一下,谢谢!
int CDC::SetMapMode(int nMapMode)
{
ASSERT(m_hDC != NULL);
int nRetVal = 0; if (m_hDC != m_hAttribDC)
nRetVal = ::SetMapMode(m_hDC, nMapMode);
if (m_hAttribDC != NULL)
nRetVal = ::SetMapMode(m_hAttribDC, nMapMode);
return nRetVal;
}
这个函数中,m_hDC的值为空,但是pDC的值不为空,我刚开始学,不太懂,请各位高手帮忙看一下,谢谢!
对应的CDC 如果是GetDC(),用完后就要ReleaseDC()来释放,如果是create得到的DC,要DeleteDC释放!
还有pen/brush、bmp等其它的一些资源,都要有对应的释放!
还有就是问一下大家如果我在WM_LBUTTONDOWN里进行点选处理的话在里面对获得的DC进行映射模式的改变会不会出现问题
而且提示出错的时间或事件并不确定,不知道啥时候就会提示这个错误