本帖最后由 jjz2009nsqdzh 于 2012-01-11 15:23:40 编辑

解决方案 »

  1.   


    CDC *pDC = GetDC();
    HBITMAP   hbmp=(HBITMAP)LoadImage(NULL, m_csFilePath ,IMAGE_BITMAP,0,0,LR_CREATEDIBSECTION|LR_LOADFROMFILE); 
    CBitmap   cbmp; 
    cbmp.Attach(hbmp); 
    BITMAP   bmp; 
    cbmp.GetBitmap(&bmp); 
    cbmp.Detach(); 
    UINT   *   pData   =   new   UINT[bmp.bmWidth   *   bmp.bmHeight]; 
    BITMAPINFO   bmpInfo; 
    bmpInfo.bmiHeader.biSize   =   sizeof(BITMAPINFOHEADER); 
    bmpInfo.bmiHeader.biWidth   =   bmp.bmWidth; 
    bmpInfo.bmiHeader.biHeight   =   -bmp.bmHeight; 
    bmpInfo.bmiHeader.biPlanes   =   1; 
    bmpInfo.bmiHeader.biCompression   =   BI_RGB; 
    bmpInfo.bmiHeader.biBitCount   =   32;  GetDIBits(pDC-> m_hDC,hbmp,0,bmp.bmHeight,pData,&bmpInfo,DIB_RGB_COLORS); 
    UINT   color,   r,   g,   b; 
    for(int i = 0;i < bmp.bmWidth*bmp.bmHeight;i++) 

    color   =   pData[i]; 
    b   =   color   <<   8   >>   24; 
    g   =   color   <<   16   >>   24; 
    r   =   color   <<   24   >>   24; 
            }