[comp.windows.ms.programmer] CS_SAVEBITS

roper@nwnexus.WA.COM (Michael Roper) (02/08/91)

Glenn Patrick Steffler writes:

> >  I would also be interested to know what exactly
> >setting a window's style to CS_SAVEBITS does.  It's supposed to save
> >the portion of the screen that is covered by another window and restore
> >that portion when the window becomes active again.  Alas, this does not
> >seem to happen...
> 
> I would think your application would know better how to manage the client
> updating better than windows.  i.e. keep a bitmap around for yourself, and
> make it discardable, so in low memory situations, the bitmap will
> disappear, but you could re-create it in such a case.  This is basically
> what windows does with the CS_SAVEBITS...notice the mention that it MAY
> NOT ALWAYS SAVE the BITS in low memory situations.

No, this is not what Windows does with CS_SAVEBITS.
CS_SAVEBITS has nothing to do with saving bitmaps
for the window created with that class style.  

Rather, if window A is a CS_SAVEBITS window and it
covers window B (which may or may not be a CS_SAVEBITS
window -- it's irrelevant), then the area of window
B obscured by window A is saved.  When window A is
subsequently removed, window B does not receive a 
WM_PAINT message -- Windows justs blits the saved
bitmap back where it belongs.

I'm not certain this is still true, but with versions
prior to 3.0, the saved bitmap was non-discardable
(believe it or not).

The most common example of a window that is CS_SAVEBITS
is the window Windows uses to display a drop-down menu.

Michael Roper
hDC Computer Corporation