I am using the following library call to change the window to dark mode:
BOOL dark = TRUE;
DwmSetWindowAttribute(hwnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &dark, sizeof(dark));
This works, with a small caveat. The title bar doesn't update until some additional event happens, like maximizing, losing focus, resizing, etc. (but not moving the window).
I have tried UpdateWindow
and a huge number of combinations of flags on RedrawWindow
with no luck. How can I force the title bar to redraw?
Edit I was able to force the reset by programmatically resizing the window, then resetting it to the previous size. But that seems like a terrible method. There must be a proper solution.