It's possible that application calls this function in previously created menu message loop, after that already created menu handle will be lost and new window will be created leaving previous one unresponsive.