Hey,
I'm trying to change the colour of an edit control by processing the WM_CTLCOLOREDIT message, but it doesn't seem to work.
Can anyone tell me what's wrong?? This is what I'm doing (win98):
From what I understand, when I process WM_CTLCOLOREDIT, wParam should have the appropriate DC, and I'm supposed to return eax=brush for background. But neither text nor background is changing...
Thanks
--Chorus
I'm trying to change the colour of an edit control by processing the WM_CTLCOLOREDIT message, but it doesn't seem to work.
Can anyone tell me what's wrong?? This is what I'm doing (win98):
WndFrameProc PROC hWin, uMsg, wParam, lParam:DWORD
mov eax,uMsg
cmp eax,WM_CREATE
je @@Create
cmp eax,WM_CTLCOLOREDIT
je @@CtlColorEdit
...
@@Create: invoke CreateWindowEx, WS_EX_CLIENTEDGE,
addr szEditClassName,
NULL,
WS_CHILD or WS_VISIBLE or ES_READONLY,
0,0,200,24,
hWin,NULL,
hInstance,NULL
mov EditWnd,eax
ret
@@CtlColorEdit: invoke SetTextColor,wParam,0FFh
invoke GetStockObject,GRAY_BRUSH
ret
...
From what I understand, when I process WM_CTLCOLOREDIT, wParam should have the appropriate DC, and I'm supposed to return eax=brush for background. But neither text nor background is changing...
Thanks
--Chorus
For those interested...
When the Edit control has the ES_READONLY style you have to process WM_CTLCOLORSTATIC instead of WM_CTLCOLOREDIT...
I didn't find this documented anywhere... sorta discovered it by accident...
--Chorus
When the Edit control has the ES_READONLY style you have to process WM_CTLCOLORSTATIC instead of WM_CTLCOLOREDIT...
I didn't find this documented anywhere... sorta discovered it by accident...
--Chorus
Hehe, I found your error.
Textboxes with ES_READONLY get the WM_CTLCOLORSTATIC. See here for an example (of course written by myself):
http://www.asmcommunity.net/board/index.php?topic=1524&highlight=read+only+white
Textboxes with ES_READONLY get the WM_CTLCOLORSTATIC. See here for an example (of course written by myself):
http://www.asmcommunity.net/board/index.php?topic=1524&highlight=read+only+white
For those interested...
When the Edit control has the ES_READONLY style you have to process WM_CTLCOLORSTATIC instead of WM_CTLCOLOREDIT...
I didn't find this documented anywhere... sorta discovered it by accident...
--Chorus
You were too fast! :)
And yes, it is documented:
(MSDN Library, WM_CTLCOLORSTATIC)
Remarks
Edit controls that are not read-only or disabled do not send
the WM_CTLCOLORSTATIC message; instead, they send the
WM_CTLCOLOREDIT message. However, for compatibility purposes,
the system sends the WM_CTLCOLOREDIT message for read-only
and disabled edit controls if the application was designed
for Windows 3.1 or earlier.
Thanks bAZiK,
My API reference must be old, cause it doesn't say that.. guess I should've bothered to check MSDN :)
Interestingly enough, neither static nor edit messages seem to work properly with a combo box edit control... I guess it's off to MSDN...
Take it easy and thanks for replying
--Chorus
My API reference must be old, cause it doesn't say that.. guess I should've bothered to check MSDN :)
Interestingly enough, neither static nor edit messages seem to work properly with a combo box edit control... I guess it's off to MSDN...
Take it easy and thanks for replying
--Chorus