That's not a problem, it's a feature. I am absolutely bloody sick of apps that go out of their way to reinvent the standard UI controls in perplexing ways and behave unexpectedly. Following the system UI preferences is what you should do, and it irritates your users if you don't.
There is a “hidden” dark mode for Win32 controls used by Windows File Explorer that you can activate, but it covers only some of the controls and still doesn’t look good.
Don't do that. If you use the regular Win32 controls then they will automatically get the styling the user has set.
I've been writing Win32 apps for close to 30 years now. It's sad to see the regression in UIs over the years.