I have create a checkbox on a Message box window using CreateWindowEx API. I
wish to now change the background color of this check box since it always
seems to take the default background color. How can I achieve this? Thank you.
>I have create a checkbox on a Message box window using CreateWindowEx API.
>I
> wish to now change the background color of this check box since it always
> seems to take the default background color. How can I achieve this? Thank
> you.
And what's wrong with the default? Don't you think that's what 99.99% of
users would want? If a users sets custom system colors, don't you think
that's what they want and what your app should use?
For the most part, don't mess around with colors for system objects (like
the background of a window or control). The only exception I can think of is
if you need to bring special attention for a short period of time. (for
example, until the user corrects something).

Signature
Mike
Microsoft MVP Visual Basic
Articulate - 21 Aug 2008 16:18 GMT
Thanks for responding to my post. The message displays a warning.. 'You are
publishing to a removable drive' and similar and the check box is for 'Don't
show this warning again.' It's button style is BS_AUTOCHECKBOX.
The code has been working fine in all version since several years now. The
issue is centered around vista which has a 2 color message box. The check box
is placed in the bottom half of the message box aligned with the butttons. It
gets the default white background color which opposed to the gray area in the
bottom half of the message box so I want to match that color.
Thanks.
> >I have create a checkbox on a Message box window using CreateWindowEx API.
> >I
[quoted text clipped - 10 lines]
> if you need to bring special attention for a short period of time. (for
> example, until the user corrects something).
Dean Earley - 21 Aug 2008 16:35 GMT
> Thanks for responding to my post. The message displays a warning.. 'You are
> publishing to a removable drive' and similar and the check box is for 'Don't
[quoted text clipped - 5 lines]
> gets the default white background color which opposed to the gray area in the
> bottom half of the message box so I want to match that color.
In that case, I think it is better to ditch the message box altogether
(for Vista) and use the underlying TaskDialogs. That will allow you to
do it all natively.

Signature
Dean Earley (dean.earley@icode.co.uk)
i-Catcher Development Team
iCode Systems
Articulate - 21 Aug 2008 19:42 GMT
Are there any examples of task dialog API functionality? Thanks
> > Thanks for responding to my post. The message displays a warning.. 'You are
> > publishing to a removable drive' and similar and the check box is for 'Don't
[quoted text clipped - 9 lines]
> (for Vista) and use the underlying TaskDialogs. That will allow you to
> do it all natively.
Articulate <Articulate@discussions.microsoft.com> schrieb im Beitrag
<B27CC136-1F3F-44E3-A1E6-37E6B9AF9B3F@microsoft.com>...
> I have create a checkbox on a Message box window using CreateWindowEx API. I
> wish to now change the background color of this check box since it always
> seems to take the default background color. How can I achieve this? Thank you.
How did you create the checkbox? There is no standard window class for
this. How the background is to be drawn or the background colour is to be
set depends on the window class.
Beside this you shouldn't add a checkbox to a message box which should
serve only to show a warning, a piece of informaton, or ask a question. For
more complex user interfaces you should use a dialog/a form.

Signature
----------------------------------------------------------------------
Thorsten Albers albers(a)uni-freiburg.de
----------------------------------------------------------------------
dominique - 21 Aug 2008 06:33 GMT
> How did you create the checkbox? There is no standard window class for
> this.
????????????????????
Read the first page of the doc...
Dean Earley - 21 Aug 2008 09:31 GMT
> How did you create the checkbox? There is no standard window class for
> this.
It's a BUTTON class.
> Beside this you shouldn't add a checkbox to a message box which should
> serve only to show a warning, a piece of informaton, or ask a question. For
> more complex user interfaces you should use a dialog/a form.
At a guess it is a "don't show this again" option.
Why they want to change the background colour of it, I don't know.

Signature
Dean Earley (dean.earley@icode.co.uk)
i-Catcher Development Team
iCode Systems
Thorsten Albers - 21 Aug 2008 13:00 GMT
Dean Earley <dean.earley@icode.co.uk> schrieb im Beitrag
<Opc3Ph2AJHA.760@TK2MSFTNGP05.phx.gbl>...
> It's a BUTTON class.
Ups, my fault.
> > Beside this you shouldn't add a checkbox to a message box which should
> > serve only to show a warning, a piece of informaton, or ask a question. For
> > more complex user interfaces you should use a dialog/a form.
> At a guess it is a "don't show this again" option.
Even then a message box is not what he should use.
@Articulate:
Check the MSDN documentation on WM_CTLCOLORBTN. It is not an easy thing to
change the background of a checkbox. The probably easiest way with this
window class would be to let the checkbox be drawn (e.g.
DrawFrameControl()) and then change the colour of every pixel inside the
checkbox frame which has the background colour.

Signature
----------------------------------------------------------------------
Thorsten Albers albers(a)uni-freiburg.de
----------------------------------------------------------------------
Articulate - 21 Aug 2008 16:17 GMT
Thanks for responding to my post. The message displays a warning.. 'You are
publishing to a removable drive' and similar and the check box is for 'Don't
show this warning again.' It's button style is BS_AUTOCHECKBOX.
The code has been working fine in all version since several years now. The
issue is centered around vista which has a 2 color message box. The check box
is placed in the bottom half of the message box aligned with the butttons. It
gets the default white background color which opposed to the gray area in the
bottom half of the message box so I want to match that color.
Thanks.
> Articulate <Articulate@discussions.microsoft.com> schrieb im Beitrag
> <B27CC136-1F3F-44E3-A1E6-37E6B9AF9B3F@microsoft.com>...
[quoted text clipped - 11 lines]
> serve only to show a warning, a piece of informaton, or ask a question. For
> more complex user interfaces you should use a dialog/a form.