I have an old-but-still-lively app (like myself !) that looks fine on Windows
98 or 2000. But when we run the same code on Windows XP, it works, but the
background color of STATIC's is not the same as the background color of the
"outer" window, so it looks like there's a box of a different color around
every label. We set the background color of the outer window in RegisterClass
to COLOR_BACKGROUND. I don't see any place to set the background color of a
STATIC. I can hard-code a color in the RegisterClass that makes it look right
on my XP machine, but then the colors are different in 2000. Am I doing
something wrong here? I thought COLOR_BACKGROUND was supposed to get me
whatever the background color is on this particular computer. Is there some
way to ask what background color is being used for STATICs? Or am I supposed
to do something to set their background color to an appropriate value? Or can
I somehow make them transparent?
PS I'm still using Visual C++ v6.0. If I need to buy a newer compiler to
make something work, I can do that, but I work for the government and it will
take months to get a purchase request through, so before I bother I want to
know if that has anything to do with it.
Tim Robinson - 15 Mar 2005 21:37 GMT
>I have an old-but-still-lively app (like myself !) that looks fine on
>Windows
[quoted text clipped - 7 lines]
> a
> STATIC.
[...]
COLOR_BACKGROUND is the desktop colour. Static controls, like most other
controls, use COLOR_3DFACE to draw themselves. You can change a static
control's colour by handling WM_CTLCOLORSTATIC in the parent.

Signature
Tim Robinson
MVP, Windows SDK
jay.johansen - 15 Mar 2005 23:39 GMT
Thanks. Turns out I had another error in that same block of code -- adding
one outside the cast instead of inside. I've apparently been using incorrect
code, copied from program to program, since 1995 when I first learned Windows
C++, and it just managed to work until XP came along. Something
philosophically amusing about that. Thanks for the help.