Solved

GDI failure/SelectObject problem

Posted on 1998-01-14
2
314 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 300 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

707 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