I want to get the height and width of a .cur file without look into its format.
I try to use LoadCursorFromFile() to get a HCURSOR, I suppose there is a API function to
Universal C++ code, for any cursor:
SIZE GetSize(HCURSOR ico)
{
SIZE res = {0};
if (ico)
{
ICONINFO info = {0};
if ( ::GetIconInfo(ico, &info)!=0 )
{
bool bBWCursor = (info.hbmColor==NULL);
BITMAP bmpinfo = {0};
if (::GetObject( info.hbmMask, sizeof(BITMAP), &bmpinfo)!=0)
{
res.cx = bmpinfo.bmWidth;
res.cy = abs(bmpinfo.bmHeight) / (bBWCursor ? 2 : 1);
}
::DeleteObject(info.hbmColor);
::DeleteObject(info.hbmMask);
}
}
return res;
}