LONG GetBitmapBits(
  HBITMAP hbmp,      // handle to bitmap
  LONG cbBuffer,     // number of bytes to copy
  LPVOID lpvBits     // buffer to receive bits
);
的到数据之后,想怎么处理,就怎么处理。

解决方案 »

  1.   

    你要操作它必需知道HDIB的结构,要不你可以用CBitmap::的Attach操作
      

  2.   

    可以在msdn中找一下foxbear的一个游戏例子程序
      

  3.   

    两位大虾,真不好意识,GETBITMAPBITS我已用过,代码是这样的:
    char * dd;
    dd= new char(500);          
    GetBitmapBits(已有数据的位图句柄,500,dd);
    SetBitmapBits(已有数据的位图句柄,500,dd);
    这段代码本想将原有的位图数据,截掉后面一块,只剩下500个字节的数据,再将它反还个原有句柄,显示出来就只有原有位图的前面一部分了,但我在C++BUILD中一运行就出错,不知为什么?
    再说开发文档中强烈建议在WIN32下不要用这个函数,而用GetDIBits函数,不知这个函数能否适用于我,该怎么用?还有SUN2000大虾,因为我用的是WINDOWS APPLICATION模版,而没有用MFC模版,我加上这个CBitmap的头文件,编译时就报告WINDOWS.h已存在...
      

  4.   

    不至于这么麻烦吧。
    用bitblt、streatchblt、
    BCB里面的CopyRect等等,都可以使先你上面提到的功能,而且更简单。如果没有包含MFC,你不能使用CBitmap。因为如果使用了MFC,就不能包含Windows.h这个文件。
      

  5.   

    请问BITBLT该怎么用呢?不好意思,我是菜鸟。
      

  6.   

    void CBlat2View::OnDraw(CDC* pDC)
    {
       CBlat2Doc* pDoc = GetDocument();
       ASSERT_VALID(pDoc);   // load IDB_BITMAP1 from our resources
       CBitmap bmp;
       if (bmp.LoadBitmap(IDB_BITMAP1))
       {
          // Get the size of the bitmap
          BITMAP bmpInfo;
          bmp.GetBitmap(&bmpInfo);      // Create an in-memory DC compatible with the
          // display DC we're using to paint
          CDC dcMemory;
          dcMemory.CreateCompatibleDC(pDC);      // Select the bitmap into the in-memory DC
          CBitmap* pOldBitmap = dcMemory.SelectObject(&bmp);      // Find a centerpoint for the bitmap in the client area
          CRect rect;
          GetClientRect(&rect);
          int nX = rect.left + (rect.Width() - bmpInfo.bmWidth) / 2;
          int nY = rect.top + (rect.Height() - bmpInfo.bmHeight) / 2;      // Copy the bits from the in-memory DC into the on-
          // screen DC to actually do the painting. Use the centerpoint
          // we computed for the target offset.
          pDC->BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 
             0, 0, SRCCOPY);      dcMemory.SelectObject(pOldBitmap);
       }
       else
          TRACE0("ERROR: Where's IDB_BITMAP1?\n");
    }