Win32 question on XP

Started by
3 comments, last by Dark Rain 20 years ago
I tried running one of the tools I created for a game under XP just to make sure it would work. To my surprise it didn't, the window background was white instead of using a window default color for "forms" to borrow from VB terms. I saw that one of my mistake was in my background brush setting (hbrBackground). I used (HBRUSH)(COLOR_WINDOW);, which gave me the right color but after a bit of reading on msdn, it seems that (HBRUSH)(COLOR_WINDOW + 1); is the correct syntax. Back to square one, this give me a white background under windows 2k, 98, 95 etc. So in short, my question is : How do I get a window I created myself to have the same background color as a windows dialog made via the ressource editor. I can't seem to come up with the right keywords on google even if this must be a fairly common problem. [edited by - Dark Rain on April 12, 2004 11:15:51 PM]
Advertisement
CreateSolidBrush(GetSysColor(COLOR_3DFACE));
Thank you very much! I thought I''d tried all the likely combinations and that the answer wasn''t there ^_^.
Glad I could help.
Don't know if this is the problem but it's something to keep in mind: (COLOR_WINDOW + 1) does not have a definite color. It's whatever color the user has set on the "Appearance" tab of the "Display Properties" dialog.

Using COLOR_3DFACE is not advised since it too is not guaranteed to be any particular color. Using it may cause unexpected results if the user decides to customize the appearance of his or her system colors.

If your background has to be white, just use a white brush.

edit: Oops, didn't catch the fact that you're looking for the background color of a dialog. Sorry, the AP's right.

[edited by - Solo on April 13, 2004 2:15:14 PM]
// Ryan

This topic is closed to new replies.

Advertisement