4

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.

IInspectable
  • 46,945
  • 8
  • 85
  • 181
steveo225
  • 11,394
  • 16
  • 62
  • 114

0 Answers0