The Phantom Bug: Why doesn't MessageBox work from my WM_NCDESTROY handler?
Adrian McCarthy ran into a problem where didn't work when called from a handler. You already know how to solve this; you just have to connect the dots. See if you can do it on your own before the answer is revealed.