I edited the code to prevent an empty message window to show up when you open and close a dialog that was minimized on your taskbar.