LONG GetBitmapBits(
HBITMAP hbmp, // handle to bitmap
LONG cbBuffer, // number of bytes to copy
LPVOID lpvBits // buffer to receive bits
);
的到数据之后,想怎么处理,就怎么处理。
HBITMAP hbmp, // handle to bitmap
LONG cbBuffer, // number of bytes to copy
LPVOID lpvBits // buffer to receive bits
);
的到数据之后,想怎么处理,就怎么处理。
解决方案 »
- 怎么修改属性表单的标题
- 拖动CTreeCtrl 中的节点到指定目录,如何取得此目录路径
- 新公司第一个项目,水晶报表的,第一次接触,都不知道水晶报表是个什么东东
- 看《windows programming》的感受
- 高手快帮忙,我又遇到棘手的问题了,如何在WIN2000下锁住逻辑卷???
- 怎么考个证!?
- 有谁有InstallShield for Windows(2.03标准版)的PassWord和注册码, 能用给分.
- 怎样在CListView上面加一行标题
- 请问,怎么设置本机的IP和网关?
- 我开始是用动态库,可编完之后想要静态库的,怎摸办?
- GetLastError()的返回值问题
- Csocket问题(简单)?
char * dd;
dd= new char(500);
GetBitmapBits(已有数据的位图句柄,500,dd);
SetBitmapBits(已有数据的位图句柄,500,dd);
这段代码本想将原有的位图数据,截掉后面一块,只剩下500个字节的数据,再将它反还个原有句柄,显示出来就只有原有位图的前面一部分了,但我在C++BUILD中一运行就出错,不知为什么?
再说开发文档中强烈建议在WIN32下不要用这个函数,而用GetDIBits函数,不知这个函数能否适用于我,该怎么用?还有SUN2000大虾,因为我用的是WINDOWS APPLICATION模版,而没有用MFC模版,我加上这个CBitmap的头文件,编译时就报告WINDOWS.h已存在...
用bitblt、streatchblt、
BCB里面的CopyRect等等,都可以使先你上面提到的功能,而且更简单。如果没有包含MFC,你不能使用CBitmap。因为如果使用了MFC,就不能包含Windows.h这个文件。
{
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");
}