How can i color a Static Text ?
Do i have to do it with sendmessage ?
like
invoke SendMessage,Handle,Command,000000h
If so which command is it ?
How can i color the background and forground of a single line edit?
Do i have to do it with sendmessage ?
like
invoke SendMessage,Handle,Command,000000h
If so which command is it ?
How can i color the background and forground of a single line edit?
To do this, you don't send a message, you receive one. You need to return the handle to a brush in response to the WM_CTLCOLORSTATIC message. Check out what msdn says right here. Be aware that Windows doesn't destroy the brush you pass to it, so you need to figure some way to destroy it yourself if necessary, otherwise you will end up with a memory leak.
Here's a little snippet to make a control with blue text with the background window color.
You can use a system color brush via GetSysColorBrush if that's what your background uses to paint. Otherwise, you should create one (ex with CreateSolidBrush), keep its handle, and destroy it when you're done.
.ELSEIF uMsg == WM_CTLCOLORSTATIC
; wParam = hDC of control, lParam = hWnd of control
invoke SetTextColor, wParam, 0FF0000h
invoke SetBkMode, wParam, TRANSPARENT
invoke GetSysColorBrush, COLOR_BTNFACE
ret
You can use a system color brush via GetSysColorBrush if that's what your background uses to paint. Otherwise, you should create one (ex with CreateSolidBrush), keep its handle, and destroy it when you're done.
Hello,
If text and bg colors are defined, what's the meaning of returned brush handle, as I tried to change simple static did no problem but on edit box it applied to the text only, not the field own...trying get the right brush I tried anuther API GetStockObject(NULL_BRUSH) or assign soid brush created at startup.
Seems there's need to create own WndProc for hacked controlz?
http://www.codeproject.com/editctrl/ceditbkcolor.asp
If i tried on WM_CTLCOLORDLG determining for the face color was just the brush, not the backcolor selected...
If text and bg colors are defined, what's the meaning of returned brush handle, as I tried to change simple static did no problem but on edit box it applied to the text only, not the field own...trying get the right brush I tried anuther API GetStockObject(NULL_BRUSH) or assign soid brush created at startup.
.elseif uMsg == WM_CTLCOLOREDIT
RGB 128, 128, 128
invoke SetBkColor, _wParam, eax
invoke GetCurrentObject, _wParam, OBJ_BRUSH
jmp Done
Seems there's need to create own WndProc for hacked controlz?
http://www.codeproject.com/editctrl/ceditbkcolor.asp
If i tried on WM_CTLCOLORDLG determining for the face color was just the brush, not the backcolor selected...