项目名称是TEST,想将窗口分割成两个,左边是树状目录CTreeView类,右边用来画图,是一般的view类
在OnCreateClient函数中加上:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext* pContext)
{
splitter.CreateStatic(this,1,);
splitter.CreateView(0,0,RUNTIME_CLASS(CTreeView),CSize(2000,100),pContext);
splitter.CreateView(0,1,RUNTIME_CLASS(CEMCView),CSize(0,100),pContext);
return true;
}
这样运行时有问题中断:
EMC.exe 中的 0x725c3a66 处未处理的异常: 0xC0000005: 读取位置 0x725c3a66 时发生访问冲突如果把中间两行改为:
splitter.CreateView(0,0,RUNTIME_CLASS(CEMCView),CSize(2000,100),pContext);
splitter.CreateView(0,1,RUNTIME_CLASS(CTreeView),CSize(0,100),pContext);这样就没有问题。
请问为什么呢?
这样树状目录就只能在屏幕的右边了,可是我需要把树状目录放在屏幕左边,这样该怎么实现呢?
在OnCreateClient函数中加上:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext* pContext)
{
splitter.CreateStatic(this,1,);
splitter.CreateView(0,0,RUNTIME_CLASS(CTreeView),CSize(2000,100),pContext);
splitter.CreateView(0,1,RUNTIME_CLASS(CEMCView),CSize(0,100),pContext);
return true;
}
这样运行时有问题中断:
EMC.exe 中的 0x725c3a66 处未处理的异常: 0xC0000005: 读取位置 0x725c3a66 时发生访问冲突如果把中间两行改为:
splitter.CreateView(0,0,RUNTIME_CLASS(CEMCView),CSize(2000,100),pContext);
splitter.CreateView(0,1,RUNTIME_CLASS(CTreeView),CSize(0,100),pContext);这样就没有问题。
请问为什么呢?
这样树状目录就只能在屏幕的右边了,可是我需要把树状目录放在屏幕左边,这样该怎么实现呢?
解决方案 »
- 对不起,发了那么多废帖,新人不太习惯....关于ListBox问题求助的正式版本 谢谢!
- 关于ListCtrl中SetItem的困惑
- 请问在windows系统下,怎样用c++函数获得系统的信息呢?
- 怎样调用帮助文件?谢谢
- i installed an english system, but it doesn't surport chinese input, and many words are displayed incorrectly,how to do with it
- 用atl制作ActiveX控件的问题
- 用CSocket写的接受pop3回应的问题!请各位高手指教
- 怎样在程序中往历史记录里添加新的记录
- 学VC有前途忙?
- Error LNK2001
- 面试题20岁的时候家庭有4人。//应该是3个人吧????
- c++调用cplex 未经处理的异常 按F11,无可用源 请教!!急!!
将
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CTESTDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
RUNTIME_CLASS(CTESTView)
);
改为
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CTESTDoc),
RUNTIME_CLASS(CMainFrame), // 主 SDI 框架窗口
NULL);
这个能编译通过吗
splitter.CreateStatic(this,1,2);
但是错误不是这个问题。
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
splitter.CreateStatic(this,1, 2);
// CNewTreeView派生自CTreeView类
// CEMCView派生自CView类
splitter.CreateView(0,0,RUNTIME_CLASS(CNewTreeView),CSize(200,100),pContext);
splitter.CreateView(0,1,RUNTIME_CLASS(CEMCView),CSize(0,100),pContext); return TRUE;
// return CFrameWnd::OnCreateClient(lpcs, pContext);
}
建议还是调试一下!
splitter.CreateView(0,0,RUNTIME_CLASS(CEMCView),CSize(100,2000),pContext);