GetDIBits函数返回0 [英] GetDIBits function returns 0

查看:287
本文介绍了GetDIBits函数返回0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在开发图像捕获应用程序,我试图使用GetDIBits调用获取BITMAPINFO,然后再将BITMAPINFO结构地址发送给函数,然后将结构内存设置为零.
如果GetDIBits的lpvbits参数为0,那么我想它应该填写BITMAPINFO结构并返回,但是该函数返回0.
代码是这样的:

Hi,

I am developing an image capture application,I am trying to fetch BITMAPINFO using GetDIBits call,before sending the BITMAPINFO structure address to the function I am memset ing the structure memory to zero.
If lpvbits parameter of the GetDIBits is 0 then I suppose it should fill in the BITMAPINFO structure and return,but the function returns 0.
this is how the code looks:

ZeroMemory(&infobm.bmiHeader,sizeof(BITMAPINFOHEADER));
                    infobm.bmiHeader.biBitCount = 24;
                    infobm.bmiHeader.biSize = sizeof(infobm);
                    infobm.bmiHeader.biHeight = 0;
                    infobm.bmiHeader.biWidth = 0;
                    infobm.bmiHeader.biPlanes = 1;
                    r = GetDIBits(dc,hbitmapHandle,0,infobm.bmiHeader.biHeight,0,&infobm,DIB_RGB_COLORS);
                    if(r == 0){
                        AfxMessageBox("Error Processing bitmap1");
                        return 1;
                    }


请帮忙,
预先感谢


Please help,
thanks in advance

推荐答案

您使用cScanLines参数(第4个)设置为zero调用了GetDIBits.那是个错误.
You called GetDIBits with cScanLines parameter (4th one) set to zero. That''s a mistake.


这篇关于GetDIBits函数返回0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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