error C2065: 'IDC_CURSOR1' : undeclared identifier MFC更改鼠标形状问题。

// cursorView.cpp : implementation of the CCursorView class
//
#include "stdafx.h"
#include "cursor.h"
#include "cursorDoc.h"
#include "cursorView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCursorView
IMPLEMENT_DYNCREATE(CCursorView, CView)
BEGIN_MESSAGE_MAP(CCursorView, CView)
//{{AFX_MSG_MAP(CCursorView)
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCursorView construction/destruction
void CCursorView::LoadCursorID(UINT Cur)
{
CurName=Cur;
}
void CCursorView::CapPoint(CPoint MousePos)
{
CRect r;
GetClientRect(&r);
int Width,Hight;
Width=MousePos.x/(r.right/3);
Hight=MousePos.y/(r.bottom/3);
switch(Width)
{case 0:
switch(Hight)
{
case 0:LoadCursorID(IDC_CURSOR1);break;
case 1:LoadCursorID(IDC_CURSOR2);break;
case 2:LoadCursorID(IDC_CURSOR3);break;
}break;
case 1:
switch(Hight)
{
case 0:LoadCursorID(IDC_CURSOR4);break;
case 1:LoadCursorID(IDC_CURSOR5);break;
case 2:LoadCursorID(IDC_CURSOR6);break;
}break;
case 2:
switch(Hight)
{
case 0:LoadCursorID(IDC_CURSOR7);break;
case 1:LoadCursorID(IDC_CURSOR8);break;
case 2:LoadCursorID(IDC_CURSOR9);break;
}break;
}
CUR=AfxGetApp()->LoadCursor(CurName);
Invalidate();
}
CCursorView::CCursorView()
{
// TODO: add construction code here
}
CCursorView::~CCursorView()
{
}
BOOL CCursorView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CCursorView drawing
void CCursorView::OnDraw(CDC* pDC)
{
CCursorDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CCursorView diagnostics
#ifdef _DEBUG
void CCursorView::AssertValid() const
{
CView::AssertValid();
}
void CCursorView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CCursorDoc* CCursorView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CCursorDoc)));
return (CCursorDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CCursorView message handlers
void CCursorView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CView::OnMouseMove(nFlags, point);
}

这是因为你没有引入资源文件或没有对应的控件资源,有两种方法可以解决:
1.#include <Resource.h>
2.#include <XX.h>——XX就是你的应用程序名称
添加前需要确定你已经存在这个ID的资源追问

我已经按照这种方法试过了,但还是错的。难道是软件有问题?
请问有英文版的VC6.0麽?windows2007兼容的...
感激不尽,1009529193本人qq

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-04-15
找到该资源ID所在头文件,包含到使用使用该资源的文件即可。
相似回答