Use
GetIconInfo function (Windows)[
^] or
GetIconInfoEx function (Windows)[
^] and send these data. This requires using the
HBITMAP
handles to get access to the bitmap data.
To get the pixel data of an
HBITMAP
use this for a DIB (Device Independant Bitmap):
DIBSECTION ds;
int nSizeDS = ::GetObject(hBitmap, sizeof(ds), &ds);
if (sizeof(ds) == nSizeDS)
{
if (0 == ds.dsBmih.biSizeImage)
{
if (0 == ds.dsBm.bmWidthBytes)
ds.dsBm.bmWidthBytes = ((ds.dsBm.bmWidth * ds.dsBm.bmBitsPixel + 31) & ~31) / 8;
ds.dsBmih.biSizeImage = ds.dsBm.bmHeight * ds.dsBm.bmWidthBytes;
}
}