HBITMAP位图转换 [英] HBITMAP to BITMAP converting

查看:246
本文介绍了HBITMAP位图转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

无法understnand什么是错的这个code:

Can't understnand what is wrong with this code:

HBITMAP bm = 0; 
BITMAP Bitmap;
bm = (HBITMAP)LoadImage (0, path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
int error = GetObject( &Bitmap, sizeof( BITMAP  ), &bm );

本的LoadImage函数返回非空指针。
然而GetObject的返回0,这表明在错误。
我想获得的信息的大小和HBITMAP指针(指针可以作为参数传递,所以我不能改变我载入位图文件的方式)的图像数据。

The LoadImage function returns non null pointer. However GetObject returns 0, which indicates on error. I want to get size info and image data from HBITMAP pointer (the pointer can be passed as parameter, so I can't change the way I load the bitmap file).

推荐答案

也许将在适当的地方的参数将有所帮助:

Maybe putting the parameters in the right places will help:

HBITMAP bm = 0; 
BITMAP Bitmap;
bm = (HBITMAP)LoadImage (0, path, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
int error = GetObject( bm, sizeof( BITMAP ), &Bitmap ); // << NOTE ORDERING

查看 <$ C $的文档C> GetObject的() 获取更多信息。

See the documentation on GetObject() for more info.

这篇关于HBITMAP位图转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆