Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - WM_CTLCOLOR
Author:Arkon
Category:Win32API
File Size:635 Bytes
Uploaded at:27-Nov-02 08:19:39 pm
Description:
  Color your controls...
  
If you want to color an edit control for instance,
you'll have to process the WM_CTLCOLOREDIT message in the PARENT window procedure:

Note that a read-only or disabled edit control will send an WM_CTLCOLORSTATIC.

//Global scope
 COLORREF bkgCol = RGB(128, 128, 128);
 HBRUSH br = CreateSolidBrush(bkgCol);

 case WM_CTLCOLOREDIT:
  SetBkColor((HDC)wParam, bkgCol);
  SetTextColor((HDC)wParam, RGB(0, 255, 0));
 return ((LRESULT)br);

//Uppon destroy of window:
 DeleteObject(br);

All controls color messages:
WM_CTLCOLOREDIT
WM_CTLCOLORBTN
WM_CTLCOLORDLG
WM_CTLCOLORLISTBOX
WM_CTLCOLORMSGBOX
WM_CTLCOLORSTATIC
User Contributed Comments(1)
 [1] Chris Done | 2006-06-28 02:13:45

Very helpful indeed. Thanks so much.
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[116858]
2D Rotated Rectangles Collision Detection[88949]
Keyboard Hook[77247]
UDP[65801]
HTTP Proxy[41189]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11557]
PS2 Mouse Driver[6953]
Wave Format Player[5788]
Reading FAT12[5615]
CodeGuru[5355]


All rights reserved to RageStorm © 2009