I have a shared icon HICON
from the following snippet.
::SendMessageTimeout(hwnd, WM_GETICON, ICON_SMALL, 0, SMTO_ABORTIFHUNG, 500, &icon)
Then I retrieved its ICONINFO
and copied out the hbmColor
and hbmMask
. As I notice in other snippets, people then call ::DeleteObject()
to destroy hbmColor
and hbmMask
.
Is that also valid for a shared icon?
As mentioned in MSDN, we should not call DestroyIcon
on a shared icon, which sounds like we should not call DestroyObject
on a shared icon's hbmColor
& hbmMask
either.
It is only necessary to call DestroyIcon for icons and cursors created with the following functions: CreateIconFromResourceEx (if called without the LR_SHARED flag), CreateIconIndirect, and CopyIcon.