MFC 为什么在VS2005环境下我没找到OnCreateClient()这个虚函数的?
来源:百度知道 编辑:UC知道 时间:2024/06/09 05:21:18
----------------------------------------------------------
// MainFrm.h : CMainFrame 类的接口
//
#pragma once
class CMainFrame : public CFrameWnd
{
protected: // 仅从序列化创建
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// 属性
public:
// 操作
public:
CSplitterWnd m_wndSplitter;
// 重写
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
// 实现
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // 控件条嵌入成员
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// 生成的消息映射函数
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
DECLARE_MESSAGE_MAP()
};
------------------------------------------------------------------
以上是整个CMainFrame类的头文件,
但并没有见到OnCreateClient()这个书上说
// MainFrm.h : CMainFrame 类的接口
//
#pragma once
class CMainFrame : public CFrameWnd
{
protected: // 仅从序列化创建
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// 属性
public:
// 操作
public:
CSplitterWnd m_wndSplitter;
// 重写
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
// 实现
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // 控件条嵌入成员
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// 生成的消息映射函数
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
DECLARE_MESSAGE_MAP()
};
------------------------------------------------------------------
以上是整个CMainFrame类的头文件,
但并没有见到OnCreateClient()这个书上说
OnCreateClient()函数是在OnCreate执行时被框架调用的,函数原型是:
virtual BOOL OnCreateClient(
LPCREATESTRUCT lpcs,
CCreateContext* pContext
);
这个函数是封装在CFrameWnd类中的.在头文件afxwin.h定义,你这个头文件在#pragma once后应该另起一行写#include "afxwin.h"
这个函数一般不调用,函数作用是根据pContext提供的信息创建一个CView对象.
以下是MSDN的资料:
Remarks
Never call this function.
The default implementation of this function creates a CView object from the information provided in pContext, if possible.
不应该啊