jackey3Lin
jackey3Lin
2014-11-16 07:45

error C2065: “CURSORINFO”: 未声明的标识符!

  • 编程

编译时提示:
1>c:\users\administrator\desktop\gh0st\server\maindll\common......\common\CursorInfo.h(60): error C2065: “CURSORINFO”: 未声明的标识符
1>c:\users\administrator\desktop\gh0st\server\maindll\common......\common\CursorInfo.h(60): error C2146: 语法错误: 缺少“;”(在标识符“ci”的前面)
1>c:\users\administrator\desktop\gh0st\server\maindll\common......\common\CursorInfo.h(60): error C2065: “ci”: 未声明的标识符
1>c:\users\administrator\desktop\gh0st\server\maindll\common......\common\CursorInfo.h(61): error C2065: “ci”: 未声明的标识符
1>c:\users\administrator\desktop\gh0st\server\maindll\common......\common\CursorInfo.h(61): error C2228: “.cbSize”的左边必须有类/结构/联合

上面“CURSORINFO”的声明是在中,但是就算我同时包含了和,它依然会如此报错,不知道该怎么解决了,下面贴出代码,希望能有老师解答...

代码如下:

#include
#if !defined(AFX_CURSORINFO_H__CE8C6529_4ACB_4BC3_96A8_C5C255A81289__INCLUDED_)
#define AFX_CURSORINFO_H__CE8C6529_4ACB_4BC3_96A8_C5C255A81289__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#define MAX_CURSOR_TYPE 16
#define IDC_HAND MAKEINTRESOURCE(32649)
class CCursorInfo

{
private:
LPCTSTR m_CursorResArray[MAX_CURSOR_TYPE];
HCURSOR m_CursorHandleArray[MAX_CURSOR_TYPE];

public:
CCursorInfo()
{
LPCTSTR CursorResArray[MAX_CURSOR_TYPE] =
{
IDC_APPSTARTING,
IDC_ARROW,
IDC_CROSS,
IDC_HAND,
IDC_HELP,
IDC_IBEAM,
IDC_ICON,
IDC_NO,
IDC_SIZE,
IDC_SIZEALL,
IDC_SIZENESW,
IDC_SIZENS,
IDC_SIZENWSE,
IDC_SIZEWE,
IDC_UPARROW,
IDC_WAIT
};

    for (int i = 0; i < MAX_CURSOR_TYPE; i++)
    {
        m_CursorResArray[i] = CursorResArray[i];
        m_CursorHandleArray[i] = LoadCursor(NULL, CursorResArray[i]);
    }
}

virtual ~CCursorInfo()
{
    for (int i = 0; i < MAX_CURSOR_TYPE; i++)
        DestroyCursor(m_CursorHandleArray[i]);
}

int getCurrentCursorIndex()
{
CURSORINFO ci;
ci.cbSize = sizeof(CURSORINFO);
if (!GetCursorInfo(&ci) || ci.flags != CURSOR_SHOWING)
return -1;
int i;
for (i = 0; i < MAX_CURSOR_TYPE; i++)
{
if (ci.hCursor == m_CursorHandleArray[i])
break;
}
DestroyCursor(ci.hCursor);

    int nIndex = i == MAX_CURSOR_TYPE ? -1 : i;
    return nIndex;
}

HCURSOR getCursorHandle( int nIndex )
{
    if (nIndex >= 0 && nIndex < MAX_CURSOR_TYPE)
        return  m_CursorHandleArray[nIndex];
    else
        return NULL;
}

};

#endif // !defined(AFX_CURSORINFO_H__CE8C6529_4ACB_4BC3_96A8_C5C255A81289__INCLUDED_)

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答