한 걸음씩..

ConvertIconToHBitmap / ConvertIconToCBitmap 본문

프로그래밍

ConvertIconToHBitmap / ConvertIconToCBitmap

smdy0426 2014. 3. 27. 13:01
반응형

/************************************

*    HIcon To HBitmap

*    HIcon To CBitmap

************************************/








HBITMAP ConvertIconToHBitmap( HICON hIcon );

void         ConvertIconToCBitmap( HICON hIcon, CBitmap *pOutBitmap );



HBITMAP ConvertIconToHBitmap( HICON hIcon ) 

{

ICONINFO IconInfo;

GetIconInfo( hIcon, &IconInfo );


HBITMAP hbmp = (HBITMAP)CopyImage( IconInfo.hbmColor,

 IMAGE_BITMAP, 

16, 

16, 

0 );


DeleteObject( IconInfo.hbmColor);

        DeleteObject( IconInfo.hbmMask);


return hbmp;

}


void ConvertIconToCBitmap( HICON hIcon, CBitmap *pOutBitmap )

{

pOutBitmap->Attach( ConvertIconToHBitmap( hIcon ) );

}



반응형