Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: C:\Windows\SYSTEM32\mfc140ud.dll
File: D:\a\_work\1\s\src\vctools\VC7Libs\Ship\ATLMFC\Src\MFC\wingdi.cpp
Line: 1113
в строке: m_headerFont.CreateFontIndirect(&lf); — см. рисунок ниже.

В момент точки останова указывается значение lf:< /p>
lfHeight: -12
lfWidth: 0
lfEscapement: 0
lfOrientation: 0
lfWeight: 700
lfItalic: 0 '\0'
lfUnderline: 0 '\0'
lfStrikeOut: 0 '\0'
lfCharSet: 1 '\x1'
lfOutPrecision: 0 '\0'
lfClipPrecision: 0 '\0'
lfQuality: 0 '\0'
lfPitchAndFamily: 0 '\0'
lfFaceName: 0x00000004b38fc8cc L"Segoe UI"
Пример кода:
class CMFCtestDlg : public CDialogEx
{
CFont m_headerFont;
//....
//...
BOOL OnInitDialog();
}
BOOL CMFCtestDlg::OnInitDialog()
{
//.......
//.......
CFont *pDefaultFont = pHeaderCtrl->GetFont();
LOGFONT lf{0};
if(pDefaultFont != nullptr && pDefaultFont->GetLogFont(&lf))
{
// If the font is MS Shell Dlg, use SystemParametersInfo to get the system font
if(_tcscmp(lf.lfFaceName, _T("MS Shell Dlg")) == 0)
{
if(SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &lf, 0))
{
lf.lfWeight = FW_BOLD;
m_headerFont.CreateFontIndirect(&lf);
pHeaderCtrl->SetFont(&m_headerFont);
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/791 ... ge-its-att
Мобильная версия