Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text color not updating in Windows XP

Status
Not open for further replies.

LuckyLuke

Programmer
Mar 28, 2001
188
NL
Hi,

I made my own menubar (like the explorer one) and everything works fine. When the system menu font changes it also changes in the menubar, but when the application is themed in windows xp, I can't get it to update the text color. I am intercepting the NM_CUSTOMDRAW messages and changing the text colors in the NMTBCUSTOMDRAW udt and I tried SetTextColor too. Using SetTextColor doesn't work in any version of windows, changing the text colors in the udt DOES work, but not in windows xp. I even tried painting the item entirely manually myself, but still the settextcolor function doesn't work. I'm sure that I am using the function correctly since I checked it on other situations. Anyone has any other idea how to change the color of the text?

Here's some part of the code I'm using:

[tt]
If hdr.Code = NM_CUSTOMDRAW Then
Call CopyMemory(nmtbcd, ByVal lParam, Len(nmtbcd))

Select Case nmtbcd.nmcd.dwDrawStage
Case CDDS_PREPAINT
bDelegate = False: ISubclass_WindowProc = CDRF_NOTIFYITEMDRAW
Case CDDS_ITEMPREPAINT
On Error Resume Next

bWinXP = IsThemeActive

On Error GoTo 0

If bWinXP Then
If m_hParentWnd <> GetActiveWindow Then
nmtbcd.clrText = GetSysColor(COLOR_GRAYTEXT)
Else
If (nmtbcd.nmcd.uItemState And CDIS_HOT) Then
nmtbcd.clrText = GetSysColor(COLOR_HIGHLIGHTTEXT)
Else
nmtbcd.clrText = GetSysColor(COLOR_MENUTEXT)
End If
End If

nmtbcd.clrHighlightHotTrack = GetSysColor(COLOR_HIGHLIGHT)
Call CopyMemory(ByVal lParam, nmtbcd, Len(nmtbcd))

bDelegate = False: ISubclass_WindowProc = TBCDRF_HILITEHOTTRACK Or TBCDRF_NOOFFSET Or TBCDRF_NOEDGES
Else
If m_hParentWnd <> GetActiveWindow Then
nmtbcd.clrText = GetSysColor(COLOR_GRAYTEXT)
Else
nmtbcd.clrText = GetSysColor(COLOR_MENUTEXT)
End If

Call CopyMemory(ByVal lParam, nmtbcd, Len(nmtbcd))
End If

End Select

End If[/tt]

Thanks in advance for your help,


LuCkY
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top