MDI程序中直接在CmainFrame中创建视图类到主窗口的窗户区,为什么视图类不能响应消息???为什么视图类不能接受操作?其中的按钮不能按???
void CMainFrame::OnTestMenu()
{
// TODO: Add your command handler code here
CRect re;
CNOFrameView *m_View;
m_View=new CNOFrameView;
//this->GetWindowRect(&re);
this->GetClientRect(&re);
//m_View->Create("CNOFrameView","Test No Frame View Of MainFrame",WS_CHILD | WS_VISIBLE,CRect(0, 0, 200, 200),this,IDD_FORMVIEW,NULL);
m_View->Create("CNOFrameView",
"Test No Frame View Of MainFrame",
WS_CHILD | WS_VISIBLE,
re,
this,
IDD_FORMVIEW,
NULL);}class CNOFrameView : public CFormView
{
//protected:
public:
CNOFrameView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CNOFrameView)// Form Data
public:
//{{AFX_DATA(CNOFrameView)
enum { IDD = IDD_FORMVIEW };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNOFrameView)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
//protected:
public:
virtual ~CNOFrameView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif // Generated message map functions
//{{AFX_MSG(CNOFrameView)
afx_msg void OnButton1();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
void CMainFrame::OnTestMenu()
{
// TODO: Add your command handler code here
CRect re;
CNOFrameView *m_View;
m_View=new CNOFrameView;
//this->GetWindowRect(&re);
this->GetClientRect(&re);
//m_View->Create("CNOFrameView","Test No Frame View Of MainFrame",WS_CHILD | WS_VISIBLE,CRect(0, 0, 200, 200),this,IDD_FORMVIEW,NULL);
m_View->Create("CNOFrameView",
"Test No Frame View Of MainFrame",
WS_CHILD | WS_VISIBLE,
re,
this,
IDD_FORMVIEW,
NULL);}class CNOFrameView : public CFormView
{
//protected:
public:
CNOFrameView(); // protected constructor used by dynamic creation
DECLARE_DYNCREATE(CNOFrameView)// Form Data
public:
//{{AFX_DATA(CNOFrameView)
enum { IDD = IDD_FORMVIEW };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA// Attributes
public:// Operations
public:// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CNOFrameView)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL// Implementation
//protected:
public:
virtual ~CNOFrameView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif // Generated message map functions
//{{AFX_MSG(CNOFrameView)
afx_msg void OnButton1();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
解决方案 »
- VC++2005开发:点对点/客户服务器网络对战、人机对战中国象棋(说明文档、源码和安装包)
- 如何获取EDITBOX中被选择部分的内容?
- 请问这是函数的什么写法?以前没见过
- 如何disable CListCtrl的某项item?
- 多文档界面程序中激活不同的子窗口闪烁/最大化后自动显示最大最小化按钮(创建时已经去掉,希望不显示)的问题
- 怎样给grid控件增加行(运行状态)?
- 请教如何从网络上的某个文件的某一点开始下载文件谢谢
- CHotKeyCtrl 怎么获得用户输入的 Ctrl+Enter 热键呢?
- word问题,在线等
- 进程结束时不会及时关闭进程所打开的handle?
- 为什么我的TabCtrl控件上放图标会出错?
- VC++和asp.net我该选谁啊?
还有就是你不能不遵守MFC的规则,不要自己自创一套。那样的话MS不就没活路了。