Re: ? Resetting CListCtrl color [flag] to (default) system color scheme

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Joseph M. Newcomer (newcomer_at_flounder.com)
Date: 05/21/04


Date: Fri, 21 May 2004 03:25:52 -0400

I didn't check out Spy++ to see the WM_SYSCOLORCHANGE being propagated downwards, but if
that is truly what happens in DefWindowProc, then the example I gave of having a
UWM_MY_COLOR_CHANGE handler can be replaced by putting in an OnSysColorChange handler in
the child control. The one line of code inside it remains the same. And the
SendMessageToDescendants call that I showed is what DefWindowProc is doing.
                                                joe

On Fri, 21 May 2004 01:40:59 GMT, v-garych@online.microsoft.com (Gary Chang) wrote:

>Hi Alex,
>
>I was reviewing this thread carefully and consulted your problem with the
>Windows User Interface team, one team member answered your question as
>below:
>
>"Actually, the message that is broadcast when the system colors change is
>WM_SYSCOLORCHANGE. Top-level windows are responsible for passing this
>message to its children. DefWindowProc will do this for you if you do not
>handle the message directly.
>
>When you customize the colors used by a standard window control (edit,
>listbox, etc) you handle one or more of the WM_CTLCOLOR* messages to set
>the text and background colors used when painting the control. The controls
>will internally hold on to the text and background colors (but not the
>brush) that were set when handling the WM_CTLCOLOR* message.
>
>The common controls tend to have specific messages that can be used to
>change the colors that are used when drawing the control, such as
>LVM_SETBKCOLOR, LVM_SETTEXTCOLOR, and LVM_SETTEXTBKCOLOR for the list view
>control. These colors are stored internally by the control.
>
>Once you start customizing a control's colors, then the application is
>responsible for updating the control's colors in response to a
>WM_SYSCOLORCHANGE message. There is no *reset* message/flag that will tell
>to controls to start using the system colors again short of destroying and
>recreating the control."
>
>
>Thanks!
>
>Best regards,
>
>Gary Chang
>Microsoft Online Partner Support
>
>Get Secure! - www.microsoft.com/security
>This posting is provided "AS IS" with no warranties, and confers no rights.
>--------------------

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm



Relevant Pages

  • Re: Cwnd::CreateEx creates a window under Win2k that looks like Win 3.1!
    ... that handles things differently than DefWindowProc. ... DefDlgProc is using an accelerator table, determining the type of control ... Visual C++ MVP ...
    (microsoft.public.vc.mfc)
  • Re: Cwnd::CreateEx creates a window under Win2k that looks like Win 3.1!
    ... CWnd say), messages aren't necessarily being routed to them? ... that handles things differently than DefWindowProc. ... DefDlgProc is using an accelerator table, determining the type of control ...
    (microsoft.public.vc.mfc)
  • Re: Political Correctness: Whats Your Definition?
    ... controversial so you look to the nearest women to see her response. ... In fact I think they ARE feminists. ... That's the beauty of it to those elites who are benefitting on both ... control of western civilization over to lots of people who don't seem to ...
    (soc.men)
  • Re: Political Correctness: Whats Your Definition?
    ... controversial so you look to the nearest women to see her response. ... That's the beauty of it to those elites who are benefitting on both ... in modern historical terms I will post here today. ... control of western civilization over to lots of people who don't seem to ...
    (soc.men)
  • Re: Qualia Question
    ... refined experimental control. ... >> That is control, not communication. ... >>>We observe such ... > "Experience color" is a response under discriminative control of feedback ...
    (comp.ai.philosophy)