Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Invalid handle - font problem??

Posted on 2007-04-04
3
Medium Priority
?
206 Views
Last Modified: 2013-11-20
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!
Mike
      
0
Comment
Question by:thready
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 2000 total points
ID: 18855677
First-chance exception message can be ignored.
Anyway, if m_FieldInfoFont is created before this line, try to release it first:

m_FieldInfoFont.DeleteObject();

m_FieldInfoFont.CreateFont(...);
0
 
LVL 1

Author Comment

by:thready
ID: 18906077
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!
Mike
0
 
LVL 1

Author Comment

by:thready
ID: 18935584
AlexFM - is there a way to stop first chance exceptions from happening (turning off a switch somewhere) so that they don't stop execution?

Mike
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question