In the lParam is passed the window handle(HWND) of the edit control that this message (WM_CTLCOLORSTATIC) applies to.
If the edit control is in a dialog you can get its control id and compare it with the id of the control that you want to set:
Code:
case WM_CTLCOLORSTATIC:
if (GetDlgCtrlID((HWND) lParam) == ID_HAUTEUR)
{
// set color for height control...
...
return TRUE;
}
else
{
return FALSE;
}
Otherwise, you usually have a variable containing the hwnd of the edit control:
Code:
case WM_CTLCOLORSTATIC:
if ((HWND) lParam == hwndEditHauteur)
{
// set color for height control...
...
return 0;
}
else
{
return DefWindowProc( ... );
}