CCreateContext 構造体CCreateContext Structure
フレームワークは、 CCreateContext
ドキュメントに関連付けられているフレームウィンドウとビューを作成するときに、構造体を使用します。The framework uses the CCreateContext
structure when it creates the frame windows and views that are associated with a document.
構文Syntax
struct CCreateContext
解説Remarks
CCreateContext
は構造体であり、基本クラスを持っていません。CCreateContext
is a structure and does not have a base class.
ウィンドウを作成すると、この構造体の値は、ドキュメントのコンポーネントをそのデータのビューに接続するために使用される情報を提供します。When you create a window, the values in this structure provide the information used to connect the components of a document to the view of its data. を使用する必要がある CCreateContext
のは、作成プロセスの一部をオーバーライドする場合のみです。You only have to use CCreateContext
if you are overriding parts of the creation process.
構造体には、 CCreateContext
ドキュメント、フレームウィンドウ、ビュー、およびドキュメントテンプレートへのポインターが含まれています。A CCreateContext
structure contains pointers to the document, the frame window, the view, and the document template. また、 CRuntimeClass
作成するビューの種類を識別するへのポインターも含まれています。It also contains a pointer to a CRuntimeClass
that identifies the type of view to create. 新しいビューを動的に作成するには、ランタイムクラス情報と現在のドキュメントポインターを使用します。The run-time class information and the current document pointer are used to create a new view dynamically. 次の表では、各メンバーがどのように使用されるかを示し CCreateContext
ます。The following table suggests how and when each CCreateContext
member might be used:
メンバーMember | 種類Type | 目的What it is for |
---|---|---|
m_pNewViewClass |
CRuntimeClass* |
CRuntimeClass 作成する新しいビューの。CRuntimeClass of the new view to create. |
m_pCurrentDoc |
CDocument* |
新しいビューに関連付けられる既存のドキュメント。The existing document to be associated with the new view. |
m_pNewDocTemplate |
CDocTemplate* |
新しい MDI フレームウィンドウの作成に関連付けられているドキュメントテンプレート。The document template associated with the creation of a new MDI frame window. |
m_pLastView |
CView* |
分割ウィンドウビューの作成やドキュメントでの2番目のビューの作成と同様に、追加のビューをモデル化する元のビュー。The original view on which additional views are modeled, as in the creation of splitter window views or the creation of a second view on a document. |
m_pCurrentFrame |
CFrameWnd* |
ドキュメント上に2つ目のフレームウィンドウを作成する場合と同様に、追加のフレームウィンドウがモデル化されるフレームウィンドウ。The frame window on which additional frame windows are modeled, as in the creation of a second frame window on a document. |
ドキュメントテンプレートは、ドキュメントとそれに関連付けられたコンポーネントを作成するときに、構造に格納されている情報を検証し CCreateContext
ます。When a document template creates a document and its associated components, it validates the information stored in the CCreateContext
structure. たとえば、存在しないドキュメントに対してビューを作成することはできません。For example, a view should not be created for a nonexistent document.
注意
内のすべてのポインター CCreateContext
は省略可能であり、指定されて NULL
いないか不明である場合があります。All of the pointers in CCreateContext
are optional and can be NULL
if unspecified or unknown.
CCreateContext
は、「参照」に記載されているメンバー関数によって使用されます。CCreateContext
is used by the member functions listed under "See Also." オーバーライドする予定の場合は、これらの関数の説明を参照してください。Consult the descriptions of these functions for specific information if you plan to override them.
いくつかの一般的なガイドラインを次に示します。Here are a few general guidelines:
、、などのように、ウィンドウ作成の引数として渡された場合、
CWnd::Create
CFrameWnd::Create
CFrameWnd::LoadFrame
作成コンテキストは新しいウィンドウの接続先を指定します。When passed as an argument for window creation, as inCWnd::Create
,CFrameWnd::Create
, andCFrameWnd::LoadFrame
, the create context specifies what the new window should be connected to. ほとんどのウィンドウでは、構造体全体は省略可能であり、NULL
ポインターを渡すことができます。For most windows, the entire structure is optional and aNULL
pointer can be passed.などのオーバーライド可能なメンバー関数の場合、
CFrameWnd::OnCreateClient
CCreateContext
引数は省略可能です。For overridable member functions, such asCFrameWnd::OnCreateClient
, theCCreateContext
argument is optional.ビューの作成に関係するメンバー関数の場合は、ビューを作成するための十分な情報を提供する必要があります。For member functions involved in view creation, you must provide enough information to create the view. たとえば、スプリッターウィンドウの最初のビューでは、ビュークラスの情報と現在のドキュメントを指定する必要があります。For example, for the first view in a splitter window, you must supply the view class information and the current document.
一般に、フレームワークの既定値を使用する場合は、を無視でき CCreateContext
ます。In general, if you use the framework defaults, you can ignore CCreateContext
. さらに高度な変更を行う場合は、Microsoft Foundation Class ライブラリソースコードまたはサンプルプログラム (VIEWEX など) に従ってください。If you attempt more advanced modifications, the Microsoft Foundation Class Library source code or the sample programs, such as VIEWEX, will guide you. 必須パラメーターを忘れた場合、フレームワークのアサーションによって、忘れたものが通知されます。If you do forget a required parameter, a framework assertion will tell you what you forgot.
の詳細については CCreateContext
、MFC のサンプル VIEWEXを参照してください。For more information on CCreateContext
, see the MFC sample VIEWEX.
要件Requirements
ヘッダー: afxext.hHeader: afxext.h
関連項目See also
階層図Hierarchy Chart
CFrameWnd:: CreateCFrameWnd::Create
CFrameWnd:: LoadFrameCFrameWnd::LoadFrame
CFrameWnd:: OnCreateClientCFrameWnd::OnCreateClient
CSplitterWnd:: CreateCSplitterWnd::Create
CSplitterWnd:: CreateViewCSplitterWnd::CreateView
CWnd::CreateCWnd::Create