The code should work fine. Are you using VC6? I tested it out just to double-check and it worked as advertised on my machine.