Dark Theme Titlebar

Hi, I’m working on an engine and i am stuck on a issue in my code…
I’ve attempted the following code:

#ifndef DWMWA_USE_IMMERSIVE_DARK_MODE
#define DWMWA_USE_IMMERSIVE_DARK_MODE 20
#endif

HWND hwnd = glfwGetWin32Window(window);
bool value = true;
::DwmSetWindowAttribute(hwnd, DWMWA_USE_IMMERSIVE_DARK_MODE, &value, sizeof(value));

but is not working…
this function is compatible only with windows 11 or im wrong?

I have defined DWMWA_USE_IMMERSIVE_DARK_MODE with the specific code for Windows compatibility.
For example:

- #define DWMWA_USE_IMMERSIVE_DARK_MODE 19 (before 20h1)
- #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 (after 20h1)

thanks…

1 Like

The type of value should be BOOL which is effectively an int, so 4 bytes rather than a bool which is usually 1 byte.

thanks now is working