VS 2008, MFC: add OnInitDialog - how?
来源:互联网 发布:新浪ip反查域名 编辑:程序博客网 时间:2024/06/07 05:35
Anyway, and also for my own reference, here are the complete steps for adding a dialog box and overriding theOnInitDialog
method:
- Select Resource View and expand the .rc file.
- Right-click the Dialog entry in the tree view and select Insert Dialog.
- Select the Properties window. (Note: If you don't see this window, select theView > Other Windows > Properties Window menu item.)
- In the Properties window, set the ID for the dialog, e.g.,
IDD_MYDIALOG
. - 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. Seethis blog post for details on how to correct this.
- In the MFC Class Wizard dialog box, enter the class name, e.g.,
CMyDialog
, selectCDialog
as the base class, then pressFinish. This will create files namedMyDialog.cpp
andMyDialog.h
and add them to your project.
To override the OnInitDialog
method in 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 theProperties window is highly context sensitive, and you get different options depending on the location of the cursor in 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!
出处:http://stackoverflow.com/questions/961617/vs-2008-mfc-add-oninitdialog-how
- VS 2008, MFC: add OnInitDialog - how?
- [MFC]如何重写OnInitDialog
- MFC对话框OnInitDialog()初始化问题
- VC 2008添加 OnInitDialog
- OninitDialog
- 如何重载MFC对话框的OnInitDialog()函数
- MFC中OnInitDialog 函数初始化问题
- MFC为子对话框添加OnInitDialog函数
- 【MFC】:MFC如何加函数,以OnInitDialog为例
- How to add custom property in custom webpart using VS 2012
- How to add OLE drag-and-drop functionality to a pre-existing MFC application
- How to add MFC Common class into your application based on SDK?
- 注意mfc下oninitdialog()和onsize()的调用顺序
- MFC中为子对话框添加OnInitDialog()函数
- MFC CDialog::OnInitDialog() 的问题 2011-12-23
- 在MFC内无法发现OnInitDialog的解决方式
- 怎样为MFC对话框建立初始化函数BOOL HistoryData::OnInitDialog()
- MFC中OnInitDialog与OnSize函数谁先调用
- 机房收费系统之数据描述
- Struts2中action之间的跳转问题
- 电脑和电视的区别:
- 写作词语_环境资源交通
- Mac Usage Tips
- VS 2008, MFC: add OnInitDialog - how?
- SQLite指南(1) -- SQLite的特性
- SQLite指南(2) -- 帮助及编译SQLite
- Hibernate读书笔记-----Hibernate的关联映射之N-1关联映射
- SQLite指南(3) - 5分钟了解熟悉SQLite
- Android动画学习笔记
- itunes相关
- jQuery中创建实例与原型继承揭秘
- SQLite指南(4) - FAQ列表(important)