Solved

Invalid handle - font problem??

Posted on 2007-04-04
3
202 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
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Include multiple hostnames in this command? 3 55
haveThree challenge 22 123
Problem to event 3 112
Problem to App 4 116
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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…
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.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

735 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