Simply follow these steps in order to change the color of the Edit control or Combobox control in ATL.
Add a handler for WM_CTLCOLOREDIT
Implementation of the handler, return the brush that u want to use to color the control
LRESULT OnCtlColorEdit(UINT uMsg,
HDC hdcEdit = (HDC) wParam; // handle to display context
HWND hwndEdit = (HWND) lParam; // handle to static control
if (( hwndEdit == GetDlgItem(IDC_EDIT)
|| ( hwndEdit == GetDlgItem(IDC_COMBO))
// m_hBrush is an instance variable that stores the
// current Color brush. If this is the first time through
// we need to create it. The brush is deleted in the destructor
if ( m_hBrush == NULL )
m_hBrush = CreateSolidBrush( RGB(255,0,0)
// Get the DC provided and set the appropriate attributes
SetBkMode(hdcEdit, TRANSPARENT );
// Return a handle to the brush
HBRUSH far* hbr = (HBRUSH far*) m_hBrush;
return ((DWORD) hbr);
Discover how to quickly remediate aggressive security threats. Read this report from Forrester Research and get the facts about new automated compliance processes and how they will reduce your organization's vulnerability and risk. Learn to:
Adopt a set of cyber "Rules of Engagement"
Define the appropriate response through the "Response Index"
Create actionable response metrics
Ensure multiple levels of audit and reinforcement
Plus, find out how to better align security and operations teams and put the …
By providing developers with the right tools to detect, understand, and fix problems early, your business can simplify software development, shorten development lifecycles, and improve the quality of software code. The end result is increased innovation, secure applications, and a faster time to market — all at a lower cost.