Click here to Skip to main content

Eligible Contests

Tagged as

HICON hIcon = AfxGetApp()->LoadStandardIcon(IDI_INFORMATION);
				
ICONINFO iconinfo;				
GetIconInfo(hIcon, &iconinfo);

ICONINFO cursorinfo;
cursorinfo = iconinfo;
cursorinfo.fIcon = FALSE;

if(m_hCursor) // make sure m_hCursor the class member variable is initialzed to NULL 
{
   ::DestroyCursor(m_hCursor);
}
m_hCursor = ::CreateIconIndirect(&cursorinfo);			

// must delete the created bitmaps due to GetIconInfo call
::DeleteObject(iconinfo.hbmMask);
::DeleteObject(iconinfo.hbmColor);

// Don't forget to destroy this cursor before application exiting

::SetCursor(m_hCursor);

License