?
Solved

GDI failure/SelectObject problem

Posted on 1998-01-14
2
Medium Priority
?
316 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
[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 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 600 total points
ID: 1299540
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
ID: 1299541
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
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…
Suggested Courses

770 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