1) The smallest difference between the working and non-working version would be nice, but I'm not sure how to get it.
2) The wrapper macros in <commctrl.h>, <windowsx.h> etc. are full of casts, which basically tells the compiler to shut up and do what it's told. I'm not saying this is the problem here, but casts can hide a lot of bugs.
3) I completely agree on staying away from Win11 ...