I used exactly the same method as you did in yours...and it works in VC++

This is really weird...I have no idea