` Printed Icetips Article

Icetips Article



Windows API: Getting rid of background redraws with subclassing
2002-09-15 -- Ville Vahtera
 
Newsgroups: TopSpeed.Topic.Third_Party


"Plugware"  wrote in message
news:3d838e68@news.softvelocity.com...
> > But like what Andy said, it's not perfect, there's always some minor
> details to
> > take care of, but right now I'm very satisfied. I havent notice memory
> leaks
> > since the first builds, the speed which "fits" all together is
> breathtaking 
> > and yes, now I have a tool that is actually working :-)
>
> Always. Let me know if you want to get rid of that flicker.

:)

I already have sublass for the client area and now I simply prevent
the WM_ERASEBKGND message from clearing the window with:

Of WM_ERASEBKGND
    Return(True)

I dont want to do double-buffing and memory-DCs, because
that method is a little slow, because the offscreen memory-DC
is created from scratch every time the window needs to be drawn.
Of cource I can create the memory DC only once, but drawback
is that this method is potentially quite memory-intensive i.e.
1024 * 768 * 32 bytes = 2.5 Mb (geez!)
Double-buffering will also be twice as slow as it needs to be,
because you are drawing once to the memory-DC, then again
during the "blit", you are using up clock cycles when you don't
need to. Granted, a fast graphics card, like I have (64MB DDR
NVidia GeForce3) will perform BitBlt  very quickly but it's still
waste of CPU time.

Cheers,
Ville

PS. Thanks for pointing this out. It forced me to examine and
learn some new tricks :-)



Printed November 23, 2024, 6:56 am
This article has been viewed/printed 35321 times.
Google search has resulted in 17 hits on this article since January 25, 2004.