1
C++을 사용하여 마우스 이미지를 얻고 싶었습니다. 내가 가지고있는 코드를
How to get mouse cursor icon VS c++ 질문에서 사용했습니다. 나는 Visual Studio 2010 IDE를 사용했다. 나는 C++ win32 프로젝트를 생성하고 그 코드 스 니펫을 _tmain 메소드에 입력했다. 누락 된 구조 (CURSORINFO 및 ICONINFO)도 추가했다. 프로젝트를 빌드 한 후 오류 콘솔이 표시됩니다.캡쳐 마우스 커서 아이콘 C++
error C2664: 'GetCursorInfo' : cannot convert parameter 1 from 'CURSORINFO *' to 'PCURSORINFO'
이 빌드 오류의 원인은 무엇입니까? 설명 할 수 있니? 이것이 제가 작성한 코드입니다.
#include "stdafx.h"
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
typedef struct _ICONINFO {
BOOL fIcon;
DWORD xHotspot;
DWORD yHotspot;
HBITMAP hbmMask;
HBITMAP hbmColor;
} ICONINFO, *PICONINFO;
typedef struct {
DWORD cbSize;
DWORD flags;
HCURSOR hCursor;
POINT ptScreenPos;
} CURSORINFO, *PCURSORINFO, *LPCURSORINFO;
HDC hdcScreen = GetDC(NULL);
HDC hdcMem = CreateCompatibleDC(hdcScreen);
CURSORINFO cursorInfo = { 0 };
cursorInfo.cbSize = sizeof(cursorInfo);
if (::GetCursorInfo(&cursorInfo))
{
ICONINFO ii = {0};
GetIconInfo(cursorInfo.hCursor, &ii);
DeleteObject(ii.hbmColor);
DeleteObject(ii.hbmMask);
::DrawIcon(hdcMem, cursorInfo.ptScreenPos.x - ii.xHotspot, cursorInfo.ptScreenPos.y - ii.yHotspot, cursorInfo.hCursor);
}
return 0;
}
정말 고마워요. 그것은 오류입니다 ....... :) – lakshman