BYTE* m_pBmpData = NULL;
BITMAPINFO* m_pBmpInfo = new BITMAPINFO[sizeof(BITMAPINFOHEADER)+sizeof(RGBQUAD)];
m_pBmpInfo->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_pBmpInfo->bmiHeader.biBitCount = 24;
m_pBmpInfo->bmiHeader.biWidth = m_nWidth;
m_pBmpInfo->bmiHeader.biHeight = 0-m_nHeight;
m_pBmpInfo->bmiHeader.biPlanes = 1;
m_pBmpInfo->bmiHeader.biCompression = BI_RGB;
m_pBmpInfo->bmiHeader.biSizeImage = 0;
m_pBmpInfo->bmiHeader.biXPelsPerMeter = 0;
m_pBmpInfo->bmiHeader.biYPelsPerMeter = 0;
m_pBmpInfo->bmiHeader.biClrUsed = 0;
m_pBmpInfo->bmiHeader.biClrImportant = 0;
CBitmap* pBitmap3 = new CBitmap();
HDC hDC = GetDC()->GetSafeHdc();
HBITMAP hBitmap;
hBitmap=CreateDIBitmap(hDC,(BITMAPINFOHEADER *)m_pBmpInfo,CBM_INIT,(VOID *)m_pBmpData,m_pBmpInfo,DIB_RGB_COLORS);
pBitmap3->Attach(hBitmap);
BITMAP bm;
pBitmap3->GetBitmap(&bm);