VS 2008, MFC: add OnInitDialog - how?

Anyway, and also for my own reference, here are the complete steps for adding a dialog box and overriding the OnInitDialog method:

  1. Select Resource View and expand the .rc file.
  2. Right-click the Dialog entry in the tree view and select Insert Dialog.
  3. Select the Properties window. (Note: If you don't see this window, select the View > Other Windows > Properties Window menu item.)
  4. In the Properties window, set the ID for the dialog, e.g., IDD_MYDIALOG.
  5. Right click the dialog in the resource editor and select Add Class. Note: if you have IE8 installed, this may produce an Internet Explorer Script Error. See this blog post for details on how to correct this.
  6. In the MFC Class Wizard dialog box, enter the class name, e.g., CMyDialog, select CDialog as the base class, then press Finish. This will create files named MyDialog.cpp and MyDialog.h and add them to your project.

To override the OnInitDialog method in the CMyDialog class:

  1. Open the file MyDialog.h.
  2. Select the Properties window.
  3. 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 Properties window is highly context sensitive, and you get different options depending on the location of the cursor in the editor.)
  4. Click the Overrides icon in the Properties window.
  5. Scroll down the properties window to find OnInitDialog.
  6. Click the down arrow against this entry and select <Add> OnInitDialog. This should create your CMyDialog::OnInitDialog function.

I hope this helps!

 

出处:http://stackoverflow.com/questions/961617/vs-2008-mfc-add-oninitdialog-how

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值