Solved

GDI failure/SelectObject problem

Posted on 1998-01-14
2
306 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
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
error email attachment VB2010 5 39
PHP PDO get the error if exists 3 89
File names with & character 6 78
Grunt No Clean Targets 6 158
Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

831 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