GDIRealizePalette16 instead of RealizePalette in order to get rid of possible deadlocks.
Attach a file by drag & drop or click to upload