GetDIBits函数返回0 [英] GetDIBits function returns 0
本文介绍了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 calledGetDIBits
withcScanLines
parameter (4th one) set tozero
. That''s a mistake.
这篇关于GetDIBits函数返回0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文