Thread: hbrBackground (WNDCLASSEX) problems in Windows XP

  1. #1
    sockets mad
    Join Date
    Mar 2002
    Posts
    126

    hbrBackground (WNDCLASSEX) problems in Windows XP

    I've been having some trouble getting my window to have the standard background colour when Windows XP themes are enabled.

    If I set the hbrBackground to COLOR_WINDOW when I have the classic Windows standard theme on, my window's background colour is the same as any other normal window background (for example a message box).

    When I switch on a Windows XP theme, Windows then seems to interpret COLOR_WINDOW and COLOR_WINDOW+1 as both white. I've tried all the likely colour constants I can think of and none of them are what I'm looking for.

    The colour that I'm after is the colour which is set in the following location in Windows XP:

    Control Panel -> Display -> Appearance -> Advanced -> 3D Objects

    Can anyone help me out on this one?

    I've done a forum search but nothing has come up relating exactly to my problem.

    Thanks for the help,

    Daniel
    C/C++ Support IRC Channel

    Server: irc.dal.net Channel: #csupport

    Come along and help make it a great resource for the community.

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Is there supposed to be a difference between COLOR_WINDOW and COLOR_WINDOW + 1? Do other constants result in different colors?

    I've had trouble in the past with XP themes and visual appearance. It seems the theme system was not completed adequately, and as a result strange behavior often occurs.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981

  4. #4
    sockets mad
    Join Date
    Mar 2002
    Posts
    126
    I'm not sure whether that article is what I'm looking for since it is mainly talking about how to use the new XP common controls, but I'm going to have a good look when I get some time later. Thanks Codeplug.

    I'm wondering what old pre-Windows XP application windows use as their hbrBackground property because Windows XP doesn't display all pre-Windows XP application windows with a white background, which is what my app is doing.

    dan
    C/C++ Support IRC Channel

    Server: irc.dal.net Channel: #csupport

    Come along and help make it a great resource for the community.

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    You're looking for COLOR_BTNFACE.
    Code:
    wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Differences between Windows XP and Windows Vista programming
    By nathan3011 in forum Windows Programming
    Replies: 3
    Last Post: 01-15-2009, 10:05 AM
  2. Windows XP - File Types and Icons
    By LuckY in forum Tech Board
    Replies: 7
    Last Post: 05-18-2005, 04:35 PM
  3. Windows Xp setup loops
    By ay_okay in forum Tech Board
    Replies: 17
    Last Post: 04-04-2005, 08:50 AM
  4. Windows xp and networking with other windows versions
    By Stoned_Coder in forum Tech Board
    Replies: 20
    Last Post: 12-19-2003, 03:36 PM
  5. windows xp and aol (im's)
    By rickc77 in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 10-26-2001, 06:50 PM