CreateDIBitmap The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits. HBITMAP CreateDIBitmap( HDC hdc, // handle to DC CONST BITMAPINFOHEADER *lpbmih, // bitmap data DWORD fdwInit, // initialization option CONST VOID *lpbInit, // initialization data CONST BITMAPINFO *lpbmi, // color-format data UINT fuUsage // color-data usage );
CDC *dc=new CDC; dc->CreateCompatibleDC(NULL); int nBitCount = GetDeviceCaps(dc->m_hDC,BITSPIXEL); LPBITMAPINFO lpBitmap; lpBitmap=(BITMAPINFO*) new BYTE[sizeof(BITMAPINFOHEADER) + GetColorNumber(nBitCount) * sizeof(RGBQUAD)];
The CreateDIBitmap function creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits. HBITMAP CreateDIBitmap(
HDC hdc, // handle to DC
CONST BITMAPINFOHEADER *lpbmih, // bitmap data
DWORD fdwInit, // initialization option
CONST VOID *lpbInit, // initialization data
CONST BITMAPINFO *lpbmi, // color-format data
UINT fuUsage // color-data usage
);
dc->CreateCompatibleDC(NULL); int nBitCount = GetDeviceCaps(dc->m_hDC,BITSPIXEL); LPBITMAPINFO lpBitmap;
lpBitmap=(BITMAPINFO*) new BYTE[sizeof(BITMAPINFOHEADER) +
GetColorNumber(nBitCount) * sizeof(RGBQUAD)];
lpBitmap->bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
lpBitmap->bmiHeader.biWidth=320;
lpBitmap->bmiHeader.biHeight=240;
lpBitmap->bmiHeader.biBitCount=nBitCount;
lpBitmap->bmiHeader.biPlanes=1;
lpBitmap->bmiHeader.biCompression=BI_RGB;
lpBitmap->bmiHeader.biSizeImage=0;
lpBitmap->bmiHeader.biClrUsed=0;
HBITMAP hBitmap=::CreateDIBSection(dc->m_hDC,lpBitmap,DIB_RGB_COLORS,&m_szPhoto,NULL,0);
帮我看看哪里错了