bmp->ico

I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
关于ICO转换我些过一段代码(bmp->ico),贴给你,希望有用。 if(hBit == NULL) // hBit is BitMap Handle
return NULL;
CBitmap oBitmap;
oBitmap.Attach(hBit);
CBitmap oBMap;
BITMAP rBitMap;
oBitmap.GetBitmap( &rBitMap );
oBMap.CreateBitmapIndirect( &rBitMap );
BYTE a[4096];
DWORD len = oBitmap.GetBitmapBits (4096,a);
for (UINT i=0; i<len; i++)
{
a ^= a;
}
oBMap.SetBitmapBits( len, a);
HICON hIcon;
if (bTheBigIcon)
{
CImageList oImagelist;
oImagelist.Create(32, 32, TRUE, 1, 1);
oImagelist.Add(&oBitmap, &oBMap);
hIcon = oImagelist.ExtractIcon( 0 );
oImagelist.DeleteImageList();
}
else
{
CImageList oImagelist;
oImagelist.Create(16, 16, TRUE, 1, 1);
oImagelist.Add(&oBitmap, &oBMap);
hIcon = oImagelist.ExtractIcon( 0 );
oImagelist.DeleteImageList();
}
m_bIcon = false;
return hIcon;
 
 
顶部