我用MapX控件开发的简单GIS程序,想拆分窗口,代码如下
MainFrame.h中的定义
protected:
CSplitterWnd m_wndSplitter;
MainFrame.CPP中重载OnCreateClient()
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
if(m_wndSplitter.CreateStatic(this,1,2)==NULL)
return FALSE;
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CGeotestView),CSize(600,600),pContext); //CGeotestView为添加显示地图的主视图
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CInfoView),CSize(100,100),pContext); //CInfoView为显示信息的视图
return TRUE; }
测试显示对话框(标题为Microsoft Visual C++ Debug Library)
Debug Assertion Failed!
Programes"D:\Geotest\Debug\Geotest.exe"
File afxwin1.inl
line:1051
........
我把上面的CGeotestView改成另外一个视图类CTestView,运行没问题。
我另外做了个测试(加了MapX控件),一个显示主视图,一个显示其他东西,结果也没问题。
真是太郁闷了,本来想自己搞定,但看来真不行了,唉~~~~郁闷几天了
求高手救命呀,
我主视图文件里代码一大堆了,不知道会不会是哪个重载函数引起的?或是哪个消息映射引起的?
//////////////////////////////////////////////////////////////////////////
请大家说说有那些可能会造成这样的结果?
还有请大家说说有哪些原因会造成编译通过,但一运行就报错的问题?
跪谢
MainFrame.h中的定义
protected:
CSplitterWnd m_wndSplitter;
MainFrame.CPP中重载OnCreateClient()
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
if(m_wndSplitter.CreateStatic(this,1,2)==NULL)
return FALSE;
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CGeotestView),CSize(600,600),pContext); //CGeotestView为添加显示地图的主视图
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CInfoView),CSize(100,100),pContext); //CInfoView为显示信息的视图
return TRUE; }
测试显示对话框(标题为Microsoft Visual C++ Debug Library)
Debug Assertion Failed!
Programes"D:\Geotest\Debug\Geotest.exe"
File afxwin1.inl
line:1051
........
我把上面的CGeotestView改成另外一个视图类CTestView,运行没问题。
我另外做了个测试(加了MapX控件),一个显示主视图,一个显示其他东西,结果也没问题。
真是太郁闷了,本来想自己搞定,但看来真不行了,唉~~~~郁闷几天了
求高手救命呀,
我主视图文件里代码一大堆了,不知道会不会是哪个重载函数引起的?或是哪个消息映射引起的?
//////////////////////////////////////////////////////////////////////////
请大家说说有那些可能会造成这样的结果?
还有请大家说说有哪些原因会造成编译通过,但一运行就报错的问题?
跪谢
1.确认头文件中: DECLARE_DYNAMIC(CGeotestView)
2.确认CPP中: IMPLEMENT_DYNAMIC(CGeotestView, CView)
3.确认OnInitalUpdate()中没有错误代码
前两个确定!
第三个函数我没有重载
确实响应了OnSize()
这是在添加MapX控件的时候必须重载的函数
我把OnSize去掉,可还是不行呀
CreateView成功了吗?
The thread 0x9B4 has exited with code -2147483645 (0x80000003).
The program 'D:\Geotest\Debug\Geotest.exe' has exited with code -2147483645 (0x80000003).
什么意思?
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CGeotestDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CGeotestView));
AddDocTemplate(pDocTemplate);请问怎么去掉?
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CGeotestDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CGeotestView));
AddDocTemplate(pDocTemplate);
改为:
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CGeotestDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CTestView));
AddDocTemplate(pDocTemplate);
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
if(m_wndSplitter.CreateStatic(this,1,2)==NULL)
return FALSE;
m_wndSplitter.CreateView(0,0,pContext->m_pNewViewClass,CSize(600,600),pContext); //CGeotestView为添加显示地图的主视图
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CInfoView),CSize(100,100),pContext); //CInfoView为显示信息的视图
return TRUE; }RUNTIME_CLASS(CGeotestView)换成pContext->m_pNewViewClass
大哥还是不行