bitmapInfoHeader.biSize = sizeof(BITMAPINFOHEADER); 
bitmapInfoHeader.biWidth = strBitmap.bmWidth; 
bitmapInfoHeader.biHeight = strBitmap.bmHeight; 
bitmapInfoHeader.biPlanes = 1; 
bitmapInfoHeader.biBitCount = wBitCount; 
bitmapInfoHeader.biClrImportant = BI_RGB; 
bitmapInfoHeader.biSizeImage = 0; //strBitmap.bmWidth * strBitmap.bmHeight; 
bitmapInfoHeader.biXPelsPerMeter = 0; 
bitmapInfoHeader.biYPelsPerMeter = 0; 
bitmapInfoHeader.biClrUsed = 0; 
bitmapInfoHeader.biClrImportant = 0; 之前为什么必须用
memset(&bitmapInfoHeader, 0, sizeof(BITMAPINFOHEADER));
把结构清空, 我不是已经给每项赋值了吗?

解决方案 »

  1.   

    主要的问题就是我现在如果不用memset(&bitmapInfoHeader, 0, sizeof(BITMAPINFOHEADER)); 这句的话.程序保存图片后,图片打开出现绘制失败,但有这句就正确了...
      

  2.   

    http://topic.csdn.net/u/20071006/02/7580ebc0-7c74-4944-8dbf-4c5212e159ae.html代码在这贴子里面.我按他们说的加了memset(&bitmapInfoHeader, 0, sizeof(BITMAPINFOHEADER)); 就行了.为什么..
      

  3.   

    该项没赋值 biCompressiontypedef struct tagBITMAPINFOHEADER{
            DWORD      biSize;
            LONG       biWidth;
            LONG       biHeight;
            WORD       biPlanes;
            WORD       biBitCount;
            DWORD      biCompression;   // 这个没有
            DWORD      biSizeImage;
            LONG       biXPelsPerMeter;
            LONG       biYPelsPerMeter;
            DWORD      biClrUsed;
            DWORD      biClrImportant;
    } BITMAPINFOHEADER, FAR *LPBITMAPINFOHEADER, *PBITMAPINFOHEADER;