I have a legacy code that creates Windows native balloon tooltips. In previous versions of Windows I could set custom background and foreground colors for tooltips using the TTM_SETTIPBKCOLOR and TTM_SETTIPTEXTCOLOR messages with the following calls:
SendMessage hwndTooltip, TTM_SETTIPBKCOLOR, BackColorValue, 0
SendMessage hwndTooltip, TTM_SETTIPTEXTCOLOR, ForeColorValue, 0
But now, when the OS visual styles are used in my app in Windows 10/11, these settings no longer work. I always see tooltips with the default system colors:
Is it possible to make the TTM_SETTIPBKCOLOR
and TTM_SETTIPTEXTCOLOR
messages work in the modern environment?
Those messages seem to be ignored when visual style is enabled on the control. You need to either custom draw the tooltip control and manually draw the background, or disable visual style on the tooltip control with a call to SetWindowTheme
Api. Set both parameters pszSubAppName
and pszSubIdList
to a null string.