Sorry. But you use ShowWindow that mean you use Modalless, MDI continue work while the Dialog show. Use DoModal the program will wait untill Dialog hide to continue.

LB_TMA