Solved

Invalid handle - font problem??

Posted on 2007-04-04
3
201 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
xyBalance chalenge 58 96
Separate into files by filename 12 87
Path of Workbook 3 86
Updating statistics with error notification email in SQL server 4 109
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.

840 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