对HBITMAP中的像素进行处理,执行CreateDIBitmap时出错,请高手解答。代码如下HBITMAP Process(HBITMAP hglb)
{
 HDC BufferDC = CreateCompatibleDC(NULL);     //源位图DC
   if(BufferDC)
   {
   //获取源位图信息
   BITMAP bm;       
   GetObject(hglb, sizeof(bm), &bm);    //初始化BITMAPINFO信息, 以便使用CreateDIBSection
   BITMAPINFO RGB32BitsBITMAPINFO;
   ZeroMemory(&RGB32BitsBITMAPINFO, sizeof(BITMAPINFO));
   RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
   RGB32BitsBITMAPINFO.bmiHeader.biWidth = bm.bmWidth;
   RGB32BitsBITMAPINFO.bmiHeader.biHeight = bm.bmHeight;
   RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
   RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
   RGB32BitsBITMAPINFO.bmiHeader.biCompression = BI_RGB;    long len = ((bm.bmWidth * bm.bmBitsPixel / 8 + 3) / 4 * 4) * bm.bmHeight;
   LPTSTR lpvBits = (LPTSTR)malloc(len);
   SelectObject(BufferDC, hglb);        //选入DC中
   int lines = GetDIBits(BufferDC, hBm, 0, bm.bmHeight, lpvBits, &RGB32BitsBITMAPINFO, DIB_RGB_COLORS);    for(long i = 0; i < len; i++)
   *lpvBits++ ^= (UCHAR)25;
   HDC DirectDC = CreateCompatibleDC(NULL);    //目标DC    if(DirectDC) 
   {
  HBITMAP NewBitmap = CreateDIBitmap(BufferDC, (BITMAPINFOHEADER*)&RGB32BitsBITMAPINFO,                        CBM_INIT, lpvBits, 
 (BITMAPINFO*)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS);
  if(!NewBitmap)
  {
DWORD err = GetLastError();
  }
                  DeleteDC(DirectDC);
            }
            DeleteDC(BufferDC);
      }
      return NewBitmap;
}返回的NewBitmap为NULL,错误码为6(ERROR_INVALID_HANDLE)。为什么?