• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 207
  • Last Modified:

Invalid handle - font problem??

Hi Experts,
I just added some new code to a program that I've been using a CDC object with for printing... I didn't modify any code that touches printing but when printing I'm now getting a "first-chance exception in MyProgram.exe (NTDLL.DLL):  0xC0000008: Invalid Handle."    I've found how to get around the problem (sort of).. it has something to do with fonts.  I had the following line:

m_FieldInfoFont.CreateFont(FIELD_INFO_SIZE*nMapFactor, 0, 0, 0, FW_BOLD, FALSE, bUnderLineFieldInfo, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, DEFAULT_QUALITY, DEFAULT_PITCH, "Arial");  //"Times New Roman");

The font change to Arial from times new roman took away the invalid handle issue.... What could be causing this?

Thank you very much!
  • 2
1 Solution
First-chance exception message can be ignored.
Anyway, if m_FieldInfoFont is created before this line, try to release it first:


threadyAuthor Commented:
Hi AlexFM,

Any idea why I could be getting there first-chance exceptions all of a sudden in code that I have not modified?  Is there a way to turn them off?

Thank you!
threadyAuthor Commented:
AlexFM - is there a way to stop first chance exceptions from happening (turning off a switch somewhere) so that they don't stop execution?

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now