Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Change colour of standard windows components

59 views
Skip to first unread message

noone

unread,
Jan 23, 2000, 3:00:00 AM1/23/00
to
Hiya,

I'm a bit of a newbie to all this Win32 programming stuff, having most
of my experience in DOS.

I'm using CreateWindow("EDIT" .... to create a multiline edit control
but I can't seem to be able to specify (or even to change) it's colour.

Can anyone help?

Steve

P.S. Please could you CC this to my email as I can't access the NGs in
college!


Jogy

unread,
Jan 24, 2000, 3:00:00 AM1/24/00
to no...@noone.com
Hello,

If you are creating controls in a dialog, you have to handle the
WM_CTLCOLOR messages
to change their colors.

For edit controls this will be WM_CTLCOLOREDIT.

In the dialog box procedure of the edit control parent use something like:

static HBRUSH hEditBrush;

case WM_INITDIALOG:
hEditBrush = CreateSolidBrush(RGB(0, 0, 128));
....

......

case WM_CTLCOLOREDIT:
SelectObject((HDC)wParam, (HGDIOBJ)hEditBrush);
return (BOOL)hEditBrush;

case WM_DESTROY:
DeleteObject(hEditBrush);


Note that you have the responsibility for creating AND deleting the
hEditBrush object.
It can be declared as a local static in the dialog box procedure, on
WM_INITDIALOG, create the brush,
and on WM_DESTROY delete the brush.

Jogy

noone wrote:

P.S. Is no...@noone.com your e-mail address ???


Jogy

unread,
Jan 24, 2000, 3:00:00 AM1/24/00
to
> > Steve
> >
> > P.S. Please could you CC this to my email as I can't access the NGs in
> > college!
>
> P.S. Is no...@noone.com your e-mail address ???

No, it is not, as I suspected. The mail returned .
So, please, give real e-mail address if you want something sent to you.

Jogy


0 new messages