静态拆分窗口问题

我想建立一个视图,静态拆分成两个窗口。我用的是Microsoft Visual Studio 2010,运行出错。



BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
TODO: Add your specialized code here and/or call the base class
//分割窗体
if (!m_wndSplitter.CreateStatic(this,1,2)) //分割成两个窗体
{
return false;
}
if (!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(DirTreeView),CSize(200,100),pContext)) //左窗格
{
m_wndSplitter.DestroyWindow();
return false;
}
if (!m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CWshPictureBrowserView),CSize(100,100),pContext)) //右窗格
{
m_wndSplitter.DestroyWindow();
return false;
}

// return CFrameWndEx::OnCreateClient(lpcs, pContext);
return TRUE;
}

错误提示:
rror C2143: syntax error : missing ';' before '*'
1>c:\users\xiaohai\desktop\wshpicturebrowser\wshpicturebrowser\wshpicturebrowserview.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\xiaohai\desktop\wshpicturebrowser\wshpicturebrowser\wshpicturebrowserview.h(16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\xiaohai\desktop\wshpicturebrowser\wshpicturebrowser\wshpicturebrowserview.h(16): warning C4183: 'GetDocument': missing return type; assumed to be a member function returning 'int'
1>
1>Build FAILED.



我的解决方法:

就是将MFC自动生成的代码里面的
WshPictureBrowserView.cpp里面的头文件包含 #include "WshPictureBrowserDoc.h""删除,并将这一句添加到WshPictureBrowserView.h
里面! 现在就没有报错了


你可能感兴趣的:(编程中所遇问题和解决方法)