Calling EndDialog within OnInitDialog causes the dialog to come up twice. It worked correctly in Visual Studio 2008 (MFC9) and Visual Studio 2010 (MFC10), but fails in Visual Studio 2012 Update 1 (MFC11)
In addition, the help documentation by Microsoft for CDialog::EndDialog even states that it can be called from within OnInitDialog. However, as stated, it causes the dialog to come up a second time.
This is often used to bring up a dialog with a progress bar on it, do something, and then close when it is done. Because of this BUG, it ends up processing twice.
The problem is caused in dlgcore.cpp (in the MFC code) line 656 where CreateRunDlgIndirect() is called back to back.