Click here to Skip to main content
15,905,238 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: is this possible? Pin
Tim Deveaux28-Feb-02 9:55
Tim Deveaux28-Feb-02 9:55 
GeneralRe: is this possible? Pin
alex.barylski28-Feb-02 10:00
alex.barylski28-Feb-02 10:00 
GeneralRe: is this possible? Pin
Tim Deveaux28-Feb-02 10:17
Tim Deveaux28-Feb-02 10:17 
GeneralRe: is this possible? Pin
Todd.Harvey1-Mar-02 3:40
Todd.Harvey1-Mar-02 3:40 
AnswerRe: is this possible? Pin
Shog928-Feb-02 9:58
sitebuilderShog928-Feb-02 9:58 
GeneralOnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 9:33
alex.barylski28-Feb-02 9:33 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Joaquín M López Muñoz28-Feb-02 10:41
Joaquín M López Muñoz28-Feb-02 10:41 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Christian Graus28-Feb-02 10:52
protectorChristian Graus28-Feb-02 10:52 
Michael Dunn is the person who made me realise how useful WM_ERASEBKGND is, so he's probably a better person to answer this.

1. WM_ERASEBKGND seems to be used to redraw the background of a window, and any invalidate call that passes the default TRUE parameter calls it first. In this sense, I find that WM_PAINT is the redundant call, in that WM_ERASEBKGND is usually a better place to try and get flicker free drawing happening. The alternative is to prepare a buffer image, create a CPaintDC and immediately Blt the image over it, which makes for minimum flicker, but doing it in WM_ERASEBKGND is really what you're trying to get as close to simulating as possible, so why not do it there ? I actually tend to use OnPrepareDC, which is the prior call to OnDraw, and I have no idea why some app types can process both pairs of messages.

The one downside to all this is you must never call Invalidate(FALSE) if you are drawing in WM_ERASEBKGND.

Joaquín M López Muñoz wrote:
What is the difference between returning TRUE or FALSE in OnEraseBkGnd?

This is a question I'd like to look at myself. In theory it is telling the framework you did or didn't handle the call, but returning either instead of calling the base method appears to have the same effect, or at least that's how it seems based on my limited testing. I've always returned TRUE until someone posted an example returning FALSE and I noticed it did the same thing.



Christian

The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Tim Smith28-Feb-02 11:10
Tim Smith28-Feb-02 11:10 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 12:22
alex.barylski28-Feb-02 12:22 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Christian Graus28-Feb-02 12:24
protectorChristian Graus28-Feb-02 12:24 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Jon Hulatt28-Feb-02 23:23
Jon Hulatt28-Feb-02 23:23 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 10:59
mentorPaul M Watt28-Feb-02 10:59 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 12:15
alex.barylski28-Feb-02 12:15 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 14:23
mentorPaul M Watt28-Feb-02 14:23 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 16:26
alex.barylski28-Feb-02 16:26 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 19:52
mentorPaul M Watt28-Feb-02 19:52 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 10:53
mentorPaul M Watt28-Feb-02 10:53 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 12:29
alex.barylski28-Feb-02 12:29 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 14:26
mentorPaul M Watt28-Feb-02 14:26 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 16:35
alex.barylski28-Feb-02 16:35 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 17:17
alex.barylski28-Feb-02 17:17 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 19:46
mentorPaul M Watt28-Feb-02 19:46 
GeneralSick and tired of VC++ IDE's $#!T Pin
Jason Hooper28-Feb-02 8:59
Jason Hooper28-Feb-02 8:59 
GeneralRe: Sick and tired of VC++ IDE's $#!T Pin
Carlos Antollini28-Feb-02 9:11
Carlos Antollini28-Feb-02 9:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.