Why does
PrintWindow
hate
CS_
?
Because
everybody hates CS_
!
Commenter kero claims that it's
"easy to fix"
the problem with
PrintWindow
and
CS_
.
You just remove the CS_
style temporarily,
then do the normal
PrintWindow
,
then restore the
CS_
style.
The question is then why
PrintWindow
simply doesn't do this.
The question assumes that the described workaround actually works. It may work in limited situations, but it certainly doesn't work in general.
Since the CS_
style is a class style,
removing the style affects all windows of that class,
not merely the window you are trying to print.
Suppose there are two windows of the class running on different threads,
and you remove the
CS_
style in anticipation of
doing a
PrintWindow
.
While that's going on,
the other window gets a
WM_
message.
Since the
CS_
style was temporarily
removed, that window will be painting with an incorrectly-clipped DC.
Result: Incorrect pixels on the screen.
The proposed workaround doesn't actually work reliably, which means that it probably shouldn't be done at all. (Random reinforcement breeds superstition.)