如何创建Doc/View类MDI MFC [英] How to create Doc/View Classes MDI MFC
问题描述
大家好,
我在VS2005下有一个MDI MFC应用程序,我有一些doc/view类(例如CUsersDoc/CUsersView).
我正在尝试创建一对新的(Doc/View),但我无法做到这一点:
我创建了一个基于文档的类,然后用Doc类作为DocumentTemplate创建了一个基于CFormView的类,但是当我尝试查看已经创建的Doc类时,我看到了
#if!defined(AFX_BFICONSULTATIONDOC_H__4D72AF8D_2711_11D4_99F9_0050BA015F99__INCLUDED_)
#define AFX_BFICONSULTATIONDOC_H__4D72AF8D_2711_11D4_99F9_0050BA015F99__INCLUDED_
....
但是我创建的那行不包含这样的行.
因此,People那里有一个指向在MDI应用程序中创建Doc/View类的好教程的链接.
很简单,只需对FormView进行重复,然后复制其中的代码即可.
在此处查看其基本知识:
创建您的第一个MFC Doc/View应用程序 [ ^ ]
#if!defined(AFX_BFICONSULTATIONDOC_H__4D72AF8D_2711_11D4_99F9_0050BA015F99__INCLUDED_) #define AFX_BFICONSULTATIONDOC_H__4D72AF8D_2711_11D4_99F9_0050BA015F99__INCLUDED _
进入上述两行:每次编译过程仅有助于一次包含文件.如果不存在,则将多次包含相同的.h,这可能会导致多个定义错误.您也可以改用一次#pragma,但要注意的事情很少- #ifndef与#pragma [ ^ ]
>
Hello all,
I Have an MDI MFC application un der VS2005, I have some doc/view classes (like CUsersDoc/CUsersView).
I was attempting to create a new pair of (Doc/View) and i could not how to do that:
I created a Document Based Class then i Created a CFormView Based One With The Doc Class as DocumentTemplate but when i tried to see the already created Doc classes i saw lignes like
#if!defined(AFX_BFICONSULTATIONDOC_H__4D72AF8D_2711_11D4_99F9_0050BA015F99__INCLUDED_)
#define AFX_BFICONSULTATIONDOC_H__4D72AF8D_2711_11D4_99F9_0050BA015F99__INCLUDED_
....
But the one that i created dosen''t include such lines.
So People is there a link to a good tutorial for creating Doc/View Classes in MDI Applicaions.
Was easy, just duplucate the FormView and then duplicate the code of the ParentView in the InitInstance().
Check this out here for the basics :
Creating your first MFC Doc/View application[^]
#if!defined(AFX_BFICONSULTATIONDOC_H__4D72AF8D_2711_11D4_99F9_0050BA015F99__INCLUDED_) #define AFX_BFICONSULTATIONDOC_H__4D72AF8D_2711_11D4_99F9_0050BA015F99__INCLUDED_
coming to the above 2 lines : This will help to include the file only one time per compilation process. If this is not there then the same .h will be included multiple times and this may lead to multiple definition errors. You can also use #pragma once instead, but there are few things to note - #ifndef vs #pragma[^]
这篇关于如何创建Doc/View类MDI MFC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!