Im working on a project that contains a status bar and would like to match the colors of it along with all the other colors of the proggie (black bg with 0FF8000h text or babyblue). Anyway, I know how to change the bg color but can't change the text color. any help on this? I have already d/led the example on radasm site (ODstatusBar i think?). Was wondering if there is like some kind of api I could use/send to status bar (ex. SB_SETTEXTCOLOR) to change the color.. Any help is appreciated.

Posted on 2004-02-03 22:21:31 by resistance_is_futile
You have to do an owner draw. Status bars have individual parts and each has to be set to owner draw with the SB_SETTEXT message. Then you have only to fill it with a color, draw the border and text in response to a WM_DRAWITEM message. Simple as that ;)


invoke SendDlgItemMessage,[hwnd], 1002, SB_SETTEXT, SBT_OWNERDRAW, 0
jmp >>.EXIT

mov edi,[lParam]
cmp D[edi+DRAWITEMSTRUCT.CtlID], 1002 ; status bar
jne >>.EXIT
invoke CreateSolidBrush, 00FF0000h ; back color
mov ebx,eax
mov esi,edi
add esi, DRAWITEMSTRUCT.rcItem
invoke FillRect, [edi+DRAWITEMSTRUCT.hdc], esi, ebx
invoke DeleteObject,ebx
invoke DrawEdge, [edi+DRAWITEMSTRUCT.hdc], esi, BDR_SUNKENINNER, BF_RECT
invoke SetTextColor, [edi+DRAWITEMSTRUCT.hdc], 000000FFh ; Text color
invoke DrawText, [edi+DRAWITEMSTRUCT.hdc], "Hello", 5, esi, \
jmp >.EXIT
Posted on 2004-02-03 22:51:19 by donkey