Thanks for all the suggestions!

Problem identified.

The config file reading/writing problem was caused by incorrect path because the current working path changed by GetOpenFileName(). So actually the config file was saved to another folder.

It was hard for me to debug the dll with .exe. "printf, cout, MessageBox" doesn't work, dont know why. any suggestions?%