copy from mfcui https://github.com/wjwonder/mfcui