I wanted to get the mouse image using C++. I used the code that I got from
How to get mouse cursor icon VS c++ question. I used visual studio 2010 IDE. I created a c++ win32 project and entered that code snippet into _tmain method and I added missing structures(CURSORINFO and ICONINFO) also. after building the project, error console shows
error C2664: 'GetCursorInfo' : cannot convert parameter 1 from 'CURSORINFO *' to 'PCURSORINFO'
what is the reason for this build error. can you explain? this is the code I built.
#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;
}