void IcoSaveAsBmp(CString strIcoFilename, CString strBmpFileName)
{
HICON hIcon = (HICON)LoadImage(NULL, strIcoFilename, IMAGE_ICON, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);
ICONINFO IconInfo;
GetIconInfo(hIcon,&IconInfo);
//定义图形大小
int iWidth = 2 * IconInfo.xHotspot;
int iHeight = 2 * IconInfo.yHotspot;
int iPixel = 16;
//图形格式参数
LPBITMAPINFO lpbmih = new BITMAPINFO;
lpbmih-> bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
lpbmih-> bmiHeader.biWidth = iWidth;
lpbmih-> bmiHeader.biHeight = iHeight;
lpbmih-> bmiHeader.biPlanes = 1;
lpbmih-> bmiHeader.biBitCount = iPixel;
lpbmih-> bmiHeader.biCompression = BI_RGB;
lpbmih-> bmiHeader.biSizeImage = 0;
lpbmih-> bmiHeader.biXPelsPerMeter = 0;
lpbmih-> bmiHeader.biYPelsPerMeter = 0;
lpbmih-> bmiHeader.biClrUsed = 0;
lpbmih-> bmiHeader.biClrImportant = 0;
//创建位图数据
HDC hdc,hdcMem;
HBITMAP hBitMap = NULL;
CBitmap *pBitMap = NULL;
CDC *pMemDC = NULL;
BYTE *pBits;
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余2页未读,立即下载
- 1
- 2
前往页