Just two code
the color of title bar will follow the system settings
The method reference is
c++ - Change the color of the title bar (caption) of a win32 application - Stack Overflow 1
Documentation see
DWMWINDOWATTRIBUTE (dwmapi.h) - Win32 apps | Microsoft Docs 1
At the same time, this API does not affect compatibility with older versions, and on Windows 7 or earlier versions of Windows, the API will not work and will not cause strange errors.