it seems something is broken since R21 with MSG_GETCUSTOMICON.
It works fine in C++ but not in Python.
Both ways won't work for me, data['useDat'] = True and filling the dat object is not working, as well as data['useDat'] = False in the old way. They only show black or transparent images now even though the bmp seems to be filled correctly
May I ask you in which context you are?
Can you share your code?
Did you take a look to the py-custom_icon.pyp plugin example.