Re: apply ::DeleteObject() for a font?

From: Jeff Partch (jeffp_at_mvps.org)
Date: 04/29/04


Date: Wed, 28 Apr 2004 19:10:01 -0500


"May Young" <tony@srac.com> wrote in message
news:409042BD.1040201@srac.com...
>
> I have a CFont member, m_myFont, in a class that is initialized in the
> class's ctor below:
>
> LOGFONT logfont;
> ....
> HFONT hFontBody = ::CreateFontIndirect(&logfont);
> m_myFont.Attach(hFontBody);

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cfont.3a3a.createfontindirect.asp

>
> In the class's destructor, do I have to do the following to avoid
> resource leaking?
> ::DeleteObject(m_myFont);

No.

-- 
Jeff Partch [VC++ MVP]