Windows 2000 Artifacts (Almost!)

Here is a problem that have keept me awake all night.

I have a application that creates a "static" window with CreateWindowEx .. It shows a string in a window. I'm using WM_CTLCOLORSTATIC to change the background and the text color . Everything works perfectly under win9x/Winnt BUT not under Windows 2000.

Lets say that I create my window for 200x20 pixel even though that my string will only occupy 150x20 so there is a void in the window of 50x20 pixel. In Win2000 that void gets filled with a different color than the windows background and thereby creating some strange artifact..

The reason I need the window to bigger is because I change the text quite offen and I dont want to resize the window everytime I change the text!

So the question is, Do Win2000 handle WM_ERASEBACKGROUND different or what controls what color and how to fill the windows background ?

/Erik

LVL 2
hougaardAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
NickRepinConnect With a Mentor Commented:
This is my answer.
0
 
NickRepinCommented:
Try to set text/background color bySetTextColor, SetBkColor and return 0, but not the brush handle.
0
 
hougaardAuthor Commented:
The correct answer is, use the NULL_BRUSH and make the window transparent.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.