希望高手给指点一下!
// Li2_31View.cpp : implementation of the CLi2_31View class
//
#include "StdAfx.h"
#include "Li2_31.h"
#include "Li2_31Doc.h"
#include "Li2_31View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CLi2_31View
IMPLEMENT_DYNCREATE(CLi2_31View, CView)
BEGIN_MESSAGE_MAP(CLi2_31View, CView)
//{{AFX_MSG_MAP(CLi2_31View)
ON_WM_CHAR()
ON_WM_KEYDOWN()
ON_WM_RBUTTONDOWN()
ON_COMMAND(ID_FILE_OPEN, OnFileOpen)
//}}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()
/////////////////////////////////////////////////////////////////////////////
// CLi2_31View construction/destruction
CLi2_31View::CLi2_31View()
{
// TODO: add construction code here
}
CLi2_31View::~CLi2_31View()
{
}
BOOL CLi2_31View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CLi2_31View drawing
void CLi2_31View::OnDraw(CDC* pDC)
{
CLi2_31Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CLi2_31View printing
BOOL CLi2_31View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CLi2_31View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CLi2_31View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CLi2_31View diagnostics
#ifdef _DEBUG
void CLi2_31View::AssertValid() const
{
CView::AssertValid();
}
void CLi2_31View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CLi2_31Doc* CLi2_31View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLi2_31Doc)));
return (CLi2_31Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CLi2_31View message handlers
void CLi2_31View::OnFileOpen()
{
// TODO: Add your command handler code here
}
void CLi2_31View::OnRButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CView::OnRButtonDown(nFlags, point);
LRESULT SendMessage(WM_MYMESSAGE);
}
LRESULT CLi2_31View::OnMyMessage(WPARAM wParam,LPARAM lParam)
{
CClientDC dc(this);
CFont NewFont,*OldFont;
NewFont.CreatePointFont(150,"黑体",NULL);
OldFont=dc.SelectObject(&NewFont);
dc.TextOut(50,100,"自定义消息WM_MYMESSAGE的处理函数被调用!");
dc.SelectObject(OldFont);
return 0;
}
调试之后出现:
D:\Program Files\Microsoft Visual Studio\MyProjects\Li2_31\Li2_31View.cpp(121) : error C2143: syntax error : missing ')' before ';'
D:\Program Files\Microsoft Visual Studio\MyProjects\Li2_31\Li2_31View.cpp(121) : error C2059: syntax error : ')'