Does anyone know the styles I could use to create an EDIT control that the user cannot change, without greying it out like ES_READONLY does?
Printable View
Does anyone know the styles I could use to create an EDIT control that the user cannot change, without greying it out like ES_READONLY does?
I would use ES_READONLY. Then handle the WM_CTLCOLORSTATIC message to give the control "normal" colors.
gg
wParam
Handle to the device context for the static control window.
lParam
Handle to the static control.
Could you explain what that acctualy means? It's going straight over my head (code is helpful! :D)
Basically in your windows procedure function have the following:
The if should be pretty self-explanitory. However, I will explain just incase. Basically you check the lParam value against the HWND returned when you used CreateWindow or CreateWindowEx in order to create your edit control. If these both equal the same (thus your read-only editbox is the control receiving this message), then you would return a handle to the brush color you want your background of the control to be. I used GetStockObject which would return a handle to the brush color, in this case WHITE_BRUSH. Which turns the background white.Code:WM_CTLCOLORSTATIC:
if( (HWND)lParam == hMyEdit ) return(GetStockObject(WHITE_BRUSH));
break;
Hope this helps,
cyreon
Cheers that worked, i just tried like 4 pieces of example code i found on google with no success.