Hi,
i ve seached around, and i have found a few similar threads.
so, is it possible to change that gray font color that windows gives to my disabled, read-only, edit box?
what i have so far is :

.elseif uMsg == WM_CTLCOLORSTATIC
invoke GetWindowLong,lParam,GWL_ID
.if eax == 503 ; My edit?
invoke GetStockObject, WHITE_BRUSH
ret
.endif

i have tried : Invoke SetTextColor,wParam,0FFh ; something
and it doesnt seem to work .

any suggestions?
Posted on 2002-10-28 08:39:57 by Ray
.elseif uMsg == WM_CTLCOLORSTATIC
invoke SetBkColor, wParam, MyColor
Posted on 2002-10-28 09:21:02 by micmic

.elseif uMsg == WM_CTLCOLORSTATIC
invoke SetBkColor, wParam, MyColor


micmic,
The above will change the BackGround color not the Font color.
Katalaves?
Posted on 2002-10-28 10:18:11 by Ray
Hi

Perhaps my attachment can be of help.
Posted on 2002-10-28 10:38:53 by minor28
Sorry, I was reading too fast :)
I guess you mean the COLOR_GRAYTEXT font, which is used after version 4.0 for disabled edit controls. The easiest way is to avoid disabling the edit control altogether, and instead change its style and make it read-only. Of course, you can subclass it, check whether it's enabled or not, process WM_PAINT messages and draw the text yourself...
Posted on 2002-10-28 11:06:53 by micmic
Heh, you are all wrong so far ;)

For an edit box, you need the WM_CTLCOLOREDIT message, not WM_CTLCOLORSTATIC.

And if i may quote MSDN:

An edit control that is not read-only or disabled sends the WM_CTLCOLOREDIT message to its parent window when the control is about to be drawn. By responding to this message, the parent window can use the specified device context handle to set the text and background colors of the edit control.


So, you might have to follow micmic's idea, and not actually disable the control.
Posted on 2002-10-29 05:29:36 by sluggy
sluggy,
but my edit box IS disabled, therefore if i read correctly, the WM_CTLCOLOREDIT will not be sent! instead WM_CTLCOLORSTATIC will be sent!

i dont see where i am wrong here :rolleyes:

I havent fount a way to change the disabled-gray-text-color...i will leave subclassing last!
Posted on 2002-10-29 12:20:23 by Ray
You could do other things too, which I'm too lazy to explore in depth: Like using SetSysColors to change the default color for COLOR_GRAYTEXT, and then restore it again when your program exits. This would have the effect of changing disabled text color in any other open windows, unless you find a way to block all WM_SYSCOLORCHANGE messages sent ... Or perhaps you could hook the API used to draw the text on the disabled control (ExtTextOut ?) and change the text color before Windows has a chance to change it again... Or you could destroy the caret of a read-only edit control so that it looks exactly like a disabled one... The point is that there is no "official" way of doing it.
Posted on 2002-10-29 16:05:04 by micmic
Maybe you should use the forum search feature: IIRC it already was discussed before...
Posted on 2002-10-29 16:08:30 by JCP
therefore if i read correctly, the WM_CTLCOLOREDIT will not be sent! instead WM_CTLCOLORSTATIC will be sent!
I read the article a bit further, and you are right. However, it looks like you cannot change from the default even though you are trapping the correct message (some of these things are not spelled out in the doco, you just have to find them out for yourself). I would suggest that you check micmic's suggestions, but i would recommend NOT changing the default system colors, that is something the user does and an app shouldn't.
Posted on 2002-10-29 19:32:50 by sluggy
minor28,

Thanks for your code! It worked with some edit boxs I had set with ES_READONLY

I used the same dialog code for a data entry and view functions.

Thanks,

farrier
Posted on 2002-10-29 22:37:20 by farrier
Radiosys,
as i mentioned in my first post, what was discussed before was about a read-only edit box not a disabled one.
slugy, micmic, thanks for your input. i ll check em out when i get some free time..
Posted on 2002-10-30 09:30:39 by Ray