zoukankan      html  css  js  c++  java
  • 转:vc6以上如何给MFC对话框添加OnInitDialog函数

    Don't feel stupid, it took me forever to figure this out when I first moved from VC6 to VS2008!

    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 theProperties 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 yourCMyDialog::OnInitDialog function.

    I hope this helps!

  • 相关阅读:
    调整swt table的行高
    获取TableViewer里面的所有TableViewerColumn
    jface viewer 全选
    jaxb生成pojo类返回类型为布尔值的问题
    EMF中复制对象属性
    向导中的参数传递 wizard param
    GEF中TreeViewer的叶子节点展开
    Cannot modify resource set without a write transaction 问题
    注册emf package并读取EMF文件
    从运行时的工作空间获取EMF文件(IFILE)
  • 原文地址:https://www.cnblogs.com/youxin/p/2858127.html
Copyright © 2011-2022 走看看