Solved

GDI failure/SelectObject problem

Posted on 1998-01-14
2
304 Views
Last Modified: 2013-12-26
I have a problem with the win32 OWL app that I am writting.

When Codeguard is turned on, I get an error whenever I call the SelectObject parameter of a TDC.

Without Codeguard, I occassionally get program crashes and occassionally SaveDC returns 0. The crashes are always GDI failures.

I have a lot of (sometimes nested) code that looks something like this:

dc.SaveDC( );
dc.SelectObject( GetTitleFont( ) );

...

dc.RestoreFont( );
dc.RestoreDC( );

Any ideas?
0
Comment
Question by:quinlan
2 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 300 total points
Comment Utility
Don't use SaveDC() and RestoreDC() if possible. They are provided for backwards compatability and they break OWL's references on objects. Instead, remove those calls and you should find that things work better. OWL's TDC classes already have the ability to save the DC state and automatically restores it afterwards.


0
 

Author Comment

by:quinlan
Comment Utility
What do you mean by "OWL's TDC classes already have the ability to save the DC state and automatically restores it afterwards."
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
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.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

762 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

9 Experts available now in Live!

Get 1:1 Help Now