Solved

Windows 2000 Artifacts (Almost!)

Posted on 2000-04-04
3
185 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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now