Solved

Windows 2000 Artifacts (Almost!)

Posted on 2000-04-04
3
187 Views
Last Modified: 2013-12-03
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

0
Comment
Question by:hougaard
  • 2
3 Comments
 
LVL 15

Expert Comment

by:NickRepin
ID: 2683171
Try to set text/background color bySetTextColor, SetBkColor and return 0, but not the brush handle.
0
 
LVL 15

Accepted Solution

by:
NickRepin earned 200 total points
ID: 2683175
This is my answer.
0
 
LVL 2

Author Comment

by:hougaard
ID: 2683507
The correct answer is, use the NULL_BRUSH and make the window transparent.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows a few slightly more advanced techniques for Windows 7 gadget programming, including how to save and restore user settings for your gadget and how to populate the "details" panel that is displayed in the Windows 7 gadget gallery.  …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question