CBitmap和HBITMAP的区别及相互转换方法
2009-05-22 20:46
330 查看
hbitmap是bitmap的指针,
msdn中:
Handle to a bitmap.typedef HANDLE HBITMAP;
cbitmap是mfc中封装bitmap的类;
msdn中:
Encapsulates(囊括) a Windows graphics device interface (GDI) bitmap and provides
member functions to manipulate(操作) the bitmap.
msdn中:
Handle to a bitmap.typedef HANDLE HBITMAP;
cbitmap是mfc中封装bitmap的类;
msdn中:
Encapsulates(囊括) a Windows graphics device interface (GDI) bitmap and provides
member functions to manipulate(操作) the bitmap.
class CBitmap : public CGdiObject 转化方法两种,Attach和FromHandle: CBitmap bmp; bmp.LoadBitmap(IDB_BITMAP1); HBITMAP hbm = (HBITMAP)bmp; CBitmap bmp1; bmp1.Attach(hbm); HBITMAP = CBitmap.m_hObject CBitmap* = CBitmap.FromHandle(HBITMAP) //已知HBITMAP hbit; CBitmap cb; cb.FromHandle(hbit); //已知CBitmap cb; HBITMAP hbit=(HBITMAP)cb; CBitmap bmp; HBITMAP hBmp; 相互转换: hBmp=(HBITMAP)bmp.GetSafeHandle(); bmp.Attach(hBmp); 注意点: Attach和FromHandle的区别 FromHandle得到的指针是临时变量, ,通过Attach连接的句柄可以长久保留,但通过FromHandle得到的只是暂时的, 大概只在一个消息区间内有效,很快便会被删除,所以基本上不能用。 我用了FromHandle然后一直出错!!! |
相关文章推荐
- CBitmap和HBITMAP的区别及相互转换方法
- CBitmap和HBITMAP的区别及相互转换方法
- CBitmap和HBITMAP的区别及相互转换方法
- 【转】CBitmap和HBITMAP的区别及相互转换方法
- CBitmap和HBITMAP的区别及相互转换方法
- CBitmap和HBITMAP的区别及相互转换方法
- HBITMAP、CBitmap与BITMAP的区别与联系及转换
- IplImage、CBitmap、HBITMAP、BITMAP之间的相互转换
- 字节码问题--wchar和char的区别以及wchar和char之间的相互转换字符编码转换等方法及函数介绍
- Bitmap、CBitmap、HBITMAP以及BITMAP的相互转换
- Bitmap、CBitmap、HBITMAP以及BITMAP的相互转换
- WebLogic的部署模式:开发模式、生产模式区别及相互转换的方法
- CBitmap、HBITMAP、BITMAP相互转换
- [转]字节码问题--wchar和char的区别以及wchar和char之间的相互转换字符编码转换等方法及函数介绍
- NSMutableString和NSString区别,及相互转换方法
- 浅谈pytorch和Numpy的区别以及相互转换方法
- Mat CvMat IplImage 之间的区别与相互转换方法
- CBitmap、HBITMAP、BITMAP相互转换
- HBITMAP、CBitmap与BITMAP的区别与联系及转换
- [转载]字节码问题--wchar和char的区别以及wchar和char之间的相互转换字符编码转换等方法及函数介绍