Solved

Invalid handle - font problem??

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa‚Ķ
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now