我已经通过project->add to Project-->component and controls-->Visual C++ Components-->Splitter Bar实现了单文档窗口分割,是一行两列,系统给出的初始代码如下:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.Create(this,1,2,CSize(10,10),pContext))
{
TRACE0("Failed to create splitter bar");
return FALSE ;
}
return TRUE;
}现在我想在两个窗口中分别显示视图,于是添加后代码如下:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.Create(this,1,2,CSize(10,10),pContext))
{
TRACE0("Failed to create splitter bar");
return FALSE ;
}
if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CLeftView),Size(200,100),pContext)||
!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CZBGLView),Size(100,100),pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE ;
} return TRUE;
}
于是开始出错:
CLeftView:is not a class or namespace name
classCLeftView:unDeclared identifier
CZBGLView:is not a class or namespace name
classCZBGLView:unDeclared identifier
我以为是没加头文件,于是添加头文件
#include "LeftView.h"
#include "ZBGLView.h"
但是这个时候又在主视图类的头文件中的同一行(CZBGLDoc* GetDocument();)报错:
syntax error:missing ';' before '*'
'CZBGLDoc':missing storage-class or type specifiers
'GetDocument':missing storage-class or type specifiers
请各位看看是什么问题,麻烦各位费心了,谢谢
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.Create(this,1,2,CSize(10,10),pContext))
{
TRACE0("Failed to create splitter bar");
return FALSE ;
}
return TRUE;
}现在我想在两个窗口中分别显示视图,于是添加后代码如下:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.Create(this,1,2,CSize(10,10),pContext))
{
TRACE0("Failed to create splitter bar");
return FALSE ;
}
if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CLeftView),Size(200,100),pContext)||
!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CZBGLView),Size(100,100),pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE ;
} return TRUE;
}
于是开始出错:
CLeftView:is not a class or namespace name
classCLeftView:unDeclared identifier
CZBGLView:is not a class or namespace name
classCZBGLView:unDeclared identifier
我以为是没加头文件,于是添加头文件
#include "LeftView.h"
#include "ZBGLView.h"
但是这个时候又在主视图类的头文件中的同一行(CZBGLDoc* GetDocument();)报错:
syntax error:missing ';' before '*'
'CZBGLDoc':missing storage-class or type specifiers
'GetDocument':missing storage-class or type specifiers
请各位看看是什么问题,麻烦各位费心了,谢谢
解决方案 »
- gdi函数的alpha透明度问题
- 如果我学会了C++???
- 各位看管来一下,关于变量存储的高低位交换的问题?
- 请问怎么样为windows2000增加一项服务?
- 请问那里可以下《Windows 程序调试》?
- 请教MODEM编程:我用笔记本的MODEM去拨银行前置机的MODEM,连通后报"无载波",就挂断了
- 用vc访问oralce9.0,如何能够使得每条记录的ID号字段保持唯一性,(其实这问题不好解决)
- ●●int型的值,往SQL语句里怎么写?●●
- combo box问题
- IOCP底层和TCP协议细节问题,一直没想清楚,诚心请教,期待您的回复
- ado 存储过程 CreateParameter 拒绝访问
- ado连接数据库的问题(有图)
!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CZBGLView),Size(100,100),pContext))
两个都是0,0位置创建??CreateView(0,0
改改再试试,
至于Document,不用的话就删除了吧,原因不明,碰到过,就删除了~
参看一下例子
#include "ZBGLView.h" 之前CRect rect;
GetClientRect(&rect);
m_wndSplitter.CreateStatic(this,2,1);
m_wndSplitter.SetScrollStyle(0);
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CLeftView),CSize(rect.Width(),rect.Height()-rect.Height()/200),pContext);
m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(CZBGLView),CSize(rect.Width(),rect.Height()/200),pContext);