内存RGB24位数据怎么用CreateDIBSection就是不显示呢?
BYTE* pData;//指向RGB24位图像数据
int ImgWidth,ImgHeight;//图像宽和高
ImgWidth=820;
ImgHeight=512;
CClientDC dc(this);
HDC hDC;
hDC=dc.GetSafeHdc();
BITMAPINFO* m_pBMI;
m_pBMI = (BITMAPINFO*)new BYTE[sizeof(BITMAPINFOHEADER)];
m_pBMI->bmiHeader.biBitCount = 24;
m_pBMI->bmiHeader.biClrImportant = 0;
m_pBMI->bmiHeader.biCompression = 0;
m_pBMI->bmiHeader.biHeight = ImgHeight;
m_pBMI->bmiHeader.biSizeImage =ImgHeight*ImgWidth;
m_pBMI->bmiHeader.biWidth = ImgWidth;
m_pBMI->bmiHeader.biClrUsed =0;
m_pBMI->bmiHeader.biPlanes = 1;
m_pBMI->bmiHeader.biSize = 40;
m_pBMI->bmiHeader.biXPelsPerMeter = 0;
m_pBMI->bmiHeader.biYPelsPerMeter =0;
CBitmap Bitmap,*pBitmap,*pOldBitmap;
BITMAP bm;
CDC MemDC;
HBITMAP m_hBitmap=::CreateDIBSection(hDC,m_lpBMIH,
DIB_RGB_COLORS, (LPVOID*) &pData, NULL, 0);
pBitmap=Bitmap.FromHandle(m_hBitmap);
MemDC.CreateCompatibleDC(&dc)
pOldBitmap=(CBitmap*)MemDC.SelectObject(pBitmap);
dc.BitBlt(0,0,ImgWidth,ImgHeight,&MemDC,0,0,SRCCOPY);
MemDC.SelectObject(pOldBitmap);