SelectObject( pFont ) returns NULL

I have defined a CFont* member in my CFormView class. The font is created as follows:
<snip>
LOGFONT lf;

lf.lfHeight = -100;
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
lf.lfWeight = FW_NORMAL;
lf.lfItalic = (BYTE) 0;
lf.lfUnderline = (BYTE) 0;
lf.lfStrikeOut = (BYTE) 0;
lf.lfCharSet = (BYTE) ANSI_CHARSET;
lf.lfOutPrecision = (BYTE)OUT_DEFAULT_PRECIS;
lf.lfClipPrecision = (BYTE) CLIP_DEFAULT_PRECIS;
lf.lfQuality = (BYTE) DEFAULT_QUALITY;

lf.lfPitchAndFamily = (BYTE) DEFAULT_PITCH|FF_DONTCARE;
strcpy( lf.lfFaceName, _T("Arial") );

m_pTextFont = new CFont;
ASSERT( m_pTextFont );

if( ! m_pTextFont->CreateFontIndirect( &lf ) )
      TRACE0("error creating Arial font\n");      

ASSERT_VALID( m_pTextFont );
</snip>

When I select the CFont* object into the device context in OnPrint(), pDC->SelectObject( m_pTextFont ) consistently returns NULL, and my font is not selected into the DC:

<snip>
if( pDC->IsPrinting() )
      pDC->SetMapMode( MM_HIENGLISH );

CFont *      pOldFont = pDC->SelectObject( m_pTextFont );
</snip>

Any ideas as to why this is happening ?
xn12z9iAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cdesignerCommented:
try to make "LOGFONT lf; "
a global variable

I use LOGFONT scructure always before print.
0
Nicolay_ChCommented:
Try use you code without LOGFONT structure....
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.