VS 2008, Mfc:add Oninitdialog-how?

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.