Change Tooltip Colors

Started by MrBcx, September 27, 2024, 06:08:30 PM

Previous topic - Next topic

MrBcx

#1
I found the way to re-enable tooltip colorizing on Windows 11 - disable themes for that control.

I learned this trick a few years ago with the Calendar control.  It's exactly the same problem/solution.
I don't know how well this will hold up for multiple dialogs with multiple tooltips but in a simple example
using my desktop clock, it holds up well.  See attached screen-shot.

BCX_hWnd_ToolTip is a global variable used by the BCX_TOOLTIP machinery, so the SUB below
just couldn't get much easier.  Create a BCX_TOOLTIP then call this sub.

SetTooltipColors(QBCOLOR(15),QBCOLOR(0))




SUB SetTooltipColors (FG AS DWORD, BG AS DWORD)
    DECLARE FUNCTION SetWindowTheme LIB "uxtheme.dll" ALIAS "SetWindowTheme" _
    (hWnd AS HWND, A AS WCHAR PTR, B AS WCHAR PTR) AS INTEGER

    DIM dummy AS wchar_t
    SetWindowTheme (BCX_hWnd_ToolTip, &dummy, &dummy)
    SendMessage(BCX_hWnd_ToolTip, TTM_SETTIPTEXTCOLOR, FG, 0)
    SendMessage(BCX_hWnd_ToolTip, TTM_SETTIPBKCOLOR, BG, 0)
END SUB