problem about font
i write CMFont class,it inheritance CFont
e.g:

class CMFont:public CFont
{..........};

========================
CMFont font;
font.CreateFont(...);
GetDlgItem(IDC_FONTID)->SetFont(&font);
error
error C2664: 'CWnd::SetFont' : cannot convert parameter 1 from 'CMFont **__w64 ' to 'CFont *'

how to CMFont convert CFont
thank:)

A couple observatons:
1. variable font needs to be a member of a class and not allocated on the stack so that it will not get auto destroyed when the function returns.

2. You probably need to typecase it

GetDlgItem(IDC_FONTID)->SetFont(reinterpret_cast<CFont*>(&font));
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.