#include "stdafx.h" namespace ActiveBasic { namespace Resource { HICON LoadIcon(HINSTANCE hinst, USHORT id, int cxDesired, int cyDesired, UINT load) { auto hrsrc = FindResource(hinst, MAKEINTRESOURCE(id), RT_GROUP_ICON); auto hMem = LoadResource(hinst, hrsrc); auto pResource = LockResource(hMem); auto idIcon = LookupIconIdFromDirectoryEx(reinterpret_cast(pResource), TRUE, cxDesired, cyDesired, load); auto hrsrcIcon = FindResource(hinst, MAKEINTRESOURCE(idIcon), MAKEINTRESOURCE(RT_ICON)); auto hIconMem = LoadResource(hinst, hrsrcIcon); auto pResourceIcon = LockResource(hIconMem); return CreateIconFromResourceEx(reinterpret_cast(pResourceIcon), SizeofResource(hinst, hrsrcIcon), TRUE, 0x00030000, cxDesired, cyDesired, load); } }}