Background:
When the landlord is doing the project,
1, a dialog Class A uses the CFont type of member variable M_font,
2, in the dialog box Class A OnInitDialog () member function to use the M_font. CreatePointFont (160, _t ("The Chinese Cloud")) and GetDlgItem (idc_xxx)->setfont (&m_font),
3. The destructor of dialog Class A is M_font. DeleteObject ().
The problems that arise:
Click on a button in the main interface to Generate dialog box Class A modal dialog box, the first time you click the button will not be a problem, the second click on the button will appear assert (M_hobject = = NULL) assertion.
Workaround:
Put M_font. CreatePointFont (160, _t ("The Chinese Cloud") moved to the constructor of dialog Class A, and the other code is unchanged. This allows a modal dialog to be generated successfully when the second click button is clicked.