LOGFONT lf;
CFont *pFont;
memset(&lf,0,sizeof(lf));
::GetObject((HFONT)GetStockObject(OEM_FIXED_FONT),sizeof(lf),&lf);
pFont->CreateFontIndirect(&lf);//断点调试执行此行时有错!
SetFont(pFont,TRUE);
以下为弹出的错误,错误行停在ASSERT(m_hObject == NULL);ASSERT(m_hObject == NULL); // only attach once, detach on destroy
if (hObject == NULL)
return FALSE;
CHandleMap* pMap = afxMapHGDIOBJ(TRUE); // create map if not exist
ASSERT(pMap != NULL);
pMap->SetPermanent(m_hObject = hObject, this);
return TRUE;忘高手指导!
CFont *pFont;
memset(&lf,0,sizeof(lf));
::GetObject((HFONT)GetStockObject(OEM_FIXED_FONT),sizeof(lf),&lf);
pFont->CreateFontIndirect(&lf);//断点调试执行此行时有错!
SetFont(pFont,TRUE);
以下为弹出的错误,错误行停在ASSERT(m_hObject == NULL);ASSERT(m_hObject == NULL); // only attach once, detach on destroy
if (hObject == NULL)
return FALSE;
CHandleMap* pMap = afxMapHGDIOBJ(TRUE); // create map if not exist
ASSERT(pMap != NULL);
pMap->SetPermanent(m_hObject = hObject, this);
return TRUE;忘高手指导!
Release时就不会执行,所以就没有错误
pFont = new CFont;这样试一下