通过编译了但是无法运行
这是CStyleView文件内的代码
#include "stdafx.h"
#include "Style.h"
#include "StyleDoc.h"
#include "StyleView.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CStyleView
IMPLEMENT_DYNCREATE(CStyleView, CView)
BEGIN_MESSAGE_MAP(CStyleView, CView)
//{{AFX_MSG_MAP(CStyleView)
ON_WM_CREATE()
ON_WM_CANCELMODE()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CStyleView construction/destruction
CStyleView::CStyleView()
{
// TODO: add construction code here
}
CStyleView::~CStyleView()
{
}
BOOL CStyleView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
//cs.lpszClass="sunxin.org";
// cs.lpszClass=AfxRegisterWndClass(CS_HREDRAW | CS_HREDRAW,
// LoadCursor(NULL,IDC_CROSS),(HBRUSH)GetStockObject(BLACK_BRUSH),0);
cs.lpszClass=AfxRegisterWndClass(CS_HREDRAW | CS_HREDRAW);//缺省状态下
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CStyleView drawing
void CStyleView::OnDraw(CDC* pDC)
{
CStyleDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CStyleView printing
BOOL CStyleView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CStyleView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CStyleView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CStyleView diagnostics
#ifdef _DEBUG
void CStyleView::AssertValid() const
{
CView::AssertValid();
}
void CStyleView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CStyleDoc* CStyleView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CStyleDoc)));
return (CStyleDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CStyleView message handlers
int CStyleView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
void CStyleView::OnMouseMove(UINT nFlags, CPoint point) //问题好像出现在这个函数里面,但是由于才学了没多久不知 道是缺什么造成的
{
// TODO: Add your message handler code here and/or call default
CString str;
str.Format("x=%d,y=%d",point.x,point.y);
((CMainFrame* )GetParent()) -> m_wndStatusBar.SetWindowText(str);
CView::OnMouseMove(nFlags, point);
}