N
Norman Bullen
Does anyone understand how a window with class style CS_SAVEBITS gets
the bitmap which it uses to restore the screen image when the window
is closed?
I'm trying to trouble-shoot a problem with a complicated dialog. The
area covered by a ComboBox drop-down is not restored correctly when
the drop-down is closed.
The main dialog is almost entirely covered by a large Tab control.
Depending on which tab the user clicks, either of two child dialogs is
shown completely within the area of the Tab control. Then, depending
on the selection in a ComboBox a "grandchild" dialog is displayed.
The grandchild dialog has a couple of check box buttons. These are
partially covered by the ComboBox drop-down and are not restored when
the drop-down closes. It looks sort of like this:
+-----------------------------------------------+
|-----------------------------------------------| <-- main dialog
| +---------+-----------+ |
| | Tab 1 \ Tab 2 \--------------------+ | <-- Tab control
| | - - - - - - - - - - - - - - - - - - - - - | | <-- child dialog
| | +----------------------+ | |
| | | Static | |V| | | | <-- ComboBox
| | +----------------------+ | |
| | | + . . . . . . . . . . . . . . . . . + | | | <-- grandchild
| | . X sllkjfelwjwlejflwejlsjclejlewj . | | dialog
| | | . X lfkewjflsvkvnlewjhvlsnlw . | | | <-- check boxes
| | + . . . . . . . . . . . . . . . . . +
The child dialog and the Tab control are both children of the main
dialog. The ComboBox and grandchild dialog (and some other controls)
are children of the child dialog. The check boxes (and some other
controls) are children of the grandchild dialog.
Looking at the application with Spy++, I discovered that each of the
five ComboBoxes (all children of the child dialog) have an associated
WS_POPUP window which presumably is used to show the drop-down list.
Normally they are not visible. The window class for these windows
(ComboLBox) has the CS_SAVEBITS style which is what prompts me to ask
about that style.
Evidently the drop-down window for this ComboBox somehow does not get
the image of the check boxes text when it becomes visible and so,
when it becomes invisible the check boxes' text is replaced with the
dialog background color.
I captured a message trace with Spy++ showing the various paint and
command messages that show what happens when the drop-down arrow on
the ComboBox is clicked and then something selected from the list.
000E08E6 S ..WM_COMMAND wNotifyCode:CBN_SETFOCUS wID:3 hwndCtl:000E0812
000E08E6 R ..WM_COMMAND
000E08E6 S WM_COMMAND wNotifyCode:CBN_DROPDOWN wID:3 hwndCtl:000E0812
000E08E6 R WM_COMMAND
000E0812 S WM_PAINT hdc:00000000
000E0812 S .WM_ERASEBKGND hdc:7B010806
000E0812 R .WM_ERASEBKGND fErased:True
000E0812 R WM_PAINT
000E0800 S .WM_ERASEBKGND hdc:470106A1
000E0800 R .WM_ERASEBKGND fErased:True
000E0812 S WM_PAINT hdc:00000000
000E0812 S .WM_ERASEBKGND hdc:7B010806
000E0812 R .WM_ERASEBKGND fErased:True
000E0812 R WM_PAINT
000E0812 S WM_COMMAND wNotifyCode:0001 wID:1000 hwndCtl:000E0800
000E08E6 S .WM_COMMAND wNotifyCode:CBN_SELENDOK wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
000E0812 S .WM_PAINT hdc:00000000
000E0812 S ..WM_ERASEBKGND hdc:44010987
000E0812 R ..WM_ERASEBKGND fErased:True
000E0812 R .WM_PAINT
000E08E6 S .WM_COMMAND wNotifyCode:CBN_CLOSEUP wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
000E08E6 S .WM_COMMAND wNotifyCode:CBN_SELCHANGE wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
000E0812 R WM_COMMAND
0009082A P WM_COMMAND wNotifyCode:BN_CLICKED wID:1008 hwndCtl:00090820
00090838 P WM_PAINT hdc:00000000
000E0818 S WM_PAINT hdc:00000000
000E0818 S .WM_NCPAINT hrgn:00000001
000E0818 R .WM_NCPAINT
000E0818 S .WM_ERASEBKGND hdc:E001092F
000E0818 R .WM_ERASEBKGND fErased:True
000E0818 R WM_PAINT
00090838 S WM_ERASEBKGND hdc:44010987
00090838 R WM_ERASEBKGND fErased:True
000E08E6 S .WM_COMMAND wNotifyCode:CBN_SELENDCANCEL wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
000E08E6 S .WM_COMMAND wNotifyCode:CBN_KILLFOCUS wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
Handle 000E08E6 is the child dialog
Handle 000E0812 is the ComboBox
Handle 000E0800 is the ComboBox drop-down list window
Handle 0008972A is the grandchild dialog
Handle 00090838 is a ListView window (not show) that is reloaded as a
of the selection in the ComboBox
Handle 000E0818 is the ListView header
Note that there are no paint messages of any kind to the child dialog,
the grandchild dialog, or the check boxes. This is to be expected
because the drop-down list window has the CS_SAVEBITS class style.
What is not expected is that the CS_SAVEBITS don't properly restore
the screen.
Any ideas,
Norm
the bitmap which it uses to restore the screen image when the window
is closed?
I'm trying to trouble-shoot a problem with a complicated dialog. The
area covered by a ComboBox drop-down is not restored correctly when
the drop-down is closed.
The main dialog is almost entirely covered by a large Tab control.
Depending on which tab the user clicks, either of two child dialogs is
shown completely within the area of the Tab control. Then, depending
on the selection in a ComboBox a "grandchild" dialog is displayed.
The grandchild dialog has a couple of check box buttons. These are
partially covered by the ComboBox drop-down and are not restored when
the drop-down closes. It looks sort of like this:
+-----------------------------------------------+
|-----------------------------------------------| <-- main dialog
| +---------+-----------+ |
| | Tab 1 \ Tab 2 \--------------------+ | <-- Tab control
| | - - - - - - - - - - - - - - - - - - - - - | | <-- child dialog
| | +----------------------+ | |
| | | Static | |V| | | | <-- ComboBox
| | +----------------------+ | |
| | | + . . . . . . . . . . . . . . . . . + | | | <-- grandchild
| | . X sllkjfelwjwlejflwejlsjclejlewj . | | dialog
| | | . X lfkewjflsvkvnlewjhvlsnlw . | | | <-- check boxes
| | + . . . . . . . . . . . . . . . . . +
The child dialog and the Tab control are both children of the main
dialog. The ComboBox and grandchild dialog (and some other controls)
are children of the child dialog. The check boxes (and some other
controls) are children of the grandchild dialog.
Looking at the application with Spy++, I discovered that each of the
five ComboBoxes (all children of the child dialog) have an associated
WS_POPUP window which presumably is used to show the drop-down list.
Normally they are not visible. The window class for these windows
(ComboLBox) has the CS_SAVEBITS style which is what prompts me to ask
about that style.
Evidently the drop-down window for this ComboBox somehow does not get
the image of the check boxes text when it becomes visible and so,
when it becomes invisible the check boxes' text is replaced with the
dialog background color.
I captured a message trace with Spy++ showing the various paint and
command messages that show what happens when the drop-down arrow on
the ComboBox is clicked and then something selected from the list.
000E08E6 S ..WM_COMMAND wNotifyCode:CBN_SETFOCUS wID:3 hwndCtl:000E0812
000E08E6 R ..WM_COMMAND
000E08E6 S WM_COMMAND wNotifyCode:CBN_DROPDOWN wID:3 hwndCtl:000E0812
000E08E6 R WM_COMMAND
000E0812 S WM_PAINT hdc:00000000
000E0812 S .WM_ERASEBKGND hdc:7B010806
000E0812 R .WM_ERASEBKGND fErased:True
000E0812 R WM_PAINT
000E0800 S .WM_ERASEBKGND hdc:470106A1
000E0800 R .WM_ERASEBKGND fErased:True
000E0812 S WM_PAINT hdc:00000000
000E0812 S .WM_ERASEBKGND hdc:7B010806
000E0812 R .WM_ERASEBKGND fErased:True
000E0812 R WM_PAINT
000E0812 S WM_COMMAND wNotifyCode:0001 wID:1000 hwndCtl:000E0800
000E08E6 S .WM_COMMAND wNotifyCode:CBN_SELENDOK wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
000E0812 S .WM_PAINT hdc:00000000
000E0812 S ..WM_ERASEBKGND hdc:44010987
000E0812 R ..WM_ERASEBKGND fErased:True
000E0812 R .WM_PAINT
000E08E6 S .WM_COMMAND wNotifyCode:CBN_CLOSEUP wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
000E08E6 S .WM_COMMAND wNotifyCode:CBN_SELCHANGE wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
000E0812 R WM_COMMAND
0009082A P WM_COMMAND wNotifyCode:BN_CLICKED wID:1008 hwndCtl:00090820
00090838 P WM_PAINT hdc:00000000
000E0818 S WM_PAINT hdc:00000000
000E0818 S .WM_NCPAINT hrgn:00000001
000E0818 R .WM_NCPAINT
000E0818 S .WM_ERASEBKGND hdc:E001092F
000E0818 R .WM_ERASEBKGND fErased:True
000E0818 R WM_PAINT
00090838 S WM_ERASEBKGND hdc:44010987
00090838 R WM_ERASEBKGND fErased:True
000E08E6 S .WM_COMMAND wNotifyCode:CBN_SELENDCANCEL wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
000E08E6 S .WM_COMMAND wNotifyCode:CBN_KILLFOCUS wID:3 hwndCtl:000E0812
000E08E6 R .WM_COMMAND
Handle 000E08E6 is the child dialog
Handle 000E0812 is the ComboBox
Handle 000E0800 is the ComboBox drop-down list window
Handle 0008972A is the grandchild dialog
Handle 00090838 is a ListView window (not show) that is reloaded as a
of the selection in the ComboBox
Handle 000E0818 is the ListView header
Note that there are no paint messages of any kind to the child dialog,
the grandchild dialog, or the check boxes. This is to be expected
because the drop-down list window has the CS_SAVEBITS class style.
What is not expected is that the CS_SAVEBITS don't properly restore
the screen.
Any ideas,
Norm