DoModal() is the correct function to display a dialog box. That 'visible' flag being off is the reason you have to do DoModal() after creating one of your dialog objects.

The OnInitDialog() function is meant to be called when your dialog box gets displayed. So hiding it again within that function doesn't make sense.

If you need to do something with you dialog class, then do it before calling DoModal().

CYourDlgClass dlg; // create a dialog object

// now do something with the dialog object as you would any other class

// now display the dialog
dlg.DoModal();

Does that help?