Relationships Among MFC Objects(MFC各对象间的关系)
来源:互联网 发布:11活动淘宝电子打几折 编辑:程序博客网 时间:2024/06/03 20:12
A document keeps a list of the views of that document and a pointer to the document template that created the document.
(文档对象保存一系列该文档对应视图,同时保存一个一个创建该文档对象的文档模板的指针)
A view keeps a pointer to its document and is a child of its parent frame window.
(视图对象保存一个其指向的文档对象的指针,视图是其父框架窗口的子窗口)
A document frame window keeps a pointer to its current active view.
(文档的框架窗口保存一个指向当前视图的指针)
A document template keeps a list of its open documents.
(文档模板保存一系列由该模板创建并打开的文档对象)
The application keeps a list of its document templates.
(the app对象保存一系列创建的文档模板对象)
Windows keeps track of all open windows so it can send messages to them.
(Windows系统可追踪所有打开的窗口,以便其能发送消息到这些窗口)
These relationships are established during document/view creation.
这种关系的建立发生在Document/View创建期间。在程序中相互获取对象的方法如下:
From object
How to access other objects
Document
Use GetFirstViewPosition and GetNextView to access the document's view list.
Call GetDocTemplate to get the document template.
View
Call GetDocument to get the document.
Call GetParentFrame to get the frame window.
Document frame window
Call GetActiveView to get the current view.
Call GetActiveDocument to get the document attached to the current view.
MDI frame window
Call MDIGetActive to get the currently active CMDIChildWnd.
Typically, a frame window has one view, but sometimes, as in splitter windows, the same frame window contains multiple views. The frame window keeps a pointer to the currently active view; the pointer is updated any time another view is activated.
通常一个Frame窗口只拥有一个View,但有时,例如在分割串口中,同一个Frame窗口可以包含多个View,此时,Frame窗口只保存当前活动View的指针,当其他View转变为活动View时,该指针会实时更新。
A pointer to the main frame window is stored in the m_pMainWnd member variable of the application object. A call to OnFileNew in your override of the InitInstance member function of CWinApp sets m_pMainWnd for you. If you do not call OnFileNew, you must set the variable's value in InitInstance yourself. (SDI COM component (server) applications may not set the variable if /Embedding is on the command line.) Note that m_pMainWnd is now a member of class CWinThread rather than CWinApp.
注意:
一个程序的主Frame窗口的指针是存储在m_pMainWnd成员变量中的。在你重写的Initinstance方法中调用OnFileNew可以设置自己的m_pMainWnd。如果不调用,就需要自己在InitInstance中设置m_pMainWnd。
- Relationships Among MFC Objects(MFC各对象间的关系)
- MFC 对象关系图
- vc的序列化和MFC各对象的关系
- MFC对象与Windows对象及C++对象的关系
- VS2010/MFC编程入门之四十(文档、视图和框架:各对象之间的关系)
- VS2010/MFC编程入门之四十(文档、视图和框架:各对象之间的关系)
- VS2010/MFC编程入门之四十(文档、视图和框架:各对象之间的关系)
- VS2013/MFC编程入门之三十七(文档、视图和框架:各对象之间的关系)
- MFC类的关系
- Win32 MFC的关系
- MFC 对象与Win32 SDK 句柄的映射关系
- 深入解析MFC -- 句柄与对象的关系
- 深入解析MFC -- 句柄与对象的关系
- 深入解析MFC -- 句柄与对象的关系
- 深入解析MFC -- 句柄与对象的关系
- MFC教程(5)-- MFC对象的创建(1)
- MFC教程(5)-- MFC对象的创建(2)
- MFC教程(5)-- MFC对象的创建(2)
- android模拟器——Genymotion 如何安装APK
- Oracle GoldenGate 配置实践
- suse linux 防火墙设置
- dms
- hibernate生成查询语句但查不到数据
- Relationships Among MFC Objects(MFC各对象间的关系)
- 《编程之美》学习笔记 1.2中国象棋将帅问题
- 令Ubuntu开机直接进入控制台,不启动x window,通过startx启动x window .
- 优秀团队与差劲团队的区别
- 23种设计模式--迭代器模式
- Android 网络通信框架Volley简介(Google IO 2013)
- cookie操作大全
- Android Framework中的PolicyManager简介
- 关于远程维护sqlite数据库的方法