|
-
June 12th, 2012, 04:08 PM
#11
Re: SelectObject() doesn't work in non-static wndproc
 Originally Posted by Distrust
It's hard to say, because when i compare them just before I call SelectObject they aren't the same - first value is negative, second is positive (after casting them to int). But if I view the value of hFont variable in constructor immediately after GetStockObject for example through the MessageBox and then just before SelectObject it seems that they are the same.
Another question concerning your design -- should a constructor be doing all of this work? What if the font creation failed during construction? Do you throw an exception, or is your class created but unusable?
I can see if you were assigning the constant DEFAULT_GUI_FONT to an int variable during construction, and then later on create the font based on the value of this int. But actually attempting to build the font during construction is IMO not what a constructor is supposed to do. Leave that for when you actually do need the font, i.e on WM_PAINT.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|