Anyway, and also for my own reference, this is are the complete steps for adding a dialog box and overriding the OnInitDialog Method:selectResource Viewand expand the. rc file. Right-click theDialogEntry in the tree view and selectInsert Dialog. Select thePropertiesWindow. (Note:if you don ' t to this window, select theView>Other Windows>Properties Windowmenu item.) In thePropertieswindow, set the ID for the dialog, e.g., Idd_mydialog. Right click on the dialog in the Resource editor and selectADD Class. Note:if you have IE8 installed, this could produce an Internet Explorer Script Error. This blog post is for the details on the how to correct this. In theMFC Class Wizarddialog box, enter the class name, e.g., CMyDialog, select CDialog as the base class, then pressFinish. This'll create files named MyDialog.cpp and MyDialog.h and add them to your project.
To override the OnInitDialog the CMyDialog class:open the file MyDialog.h. Select the Properties window. Place the cursor on the line that reads Class Cmydialog:public CDialog. (The top of the Properties window should show "CMyDialog VCCodeClass"-This is important, because the Proper Ties window is highly context sensitive, and I different options depending on the location of the Editor.) Click the Overrides icon in the Properties window. Scroll down the Properties window to find OnInitDialog. Click the down arrow against this entry and select <Add> oninitdialog. This should create your Cmydialog::oninitdialog function.
I Hope this helps!
Source: Http://stackoverflow.com/questions/961617/vs-2008-mfc-add-oninitdialog-how