简体   繁体   English

Windows GDI上下文-CreateDIBSection

[英]Windows GDI Context - CreateDIBSection

I am using CreateDIBSection() to create a HBITMAP from a buffer, but sometimes - with no regular occurrence - I get a NULL pointer from it. 我正在使用CreateDIBSection()从缓冲区创建HBITMAP,但是有时-没有定期发生-我从其中获取了NULL指针。 I can't understand what may cause the function to return a NULL pointer because - as I said before - it is not regular. 我不明白是什么导致函数返回NULL指针,因为-如我之前所说-它不规则。 Sometimes it happens after displaying 10 frames, sometimes after 2 frames. 有时会在显示10帧后发生,有时会在2帧后发生。 Can someone explain me which are the possible reasons of the unexpected fail? 有人可以向我解释意外失败的可能原因是什么?

If this function is failing at random, I would be inclined to think that the buffer is not correctly formatted or is messed up. 如果此函数随机失败,我将倾向于认为缓冲区的格式不正确或弄乱了。 Go back in the code that creates the buffer and see if any of the functions fail there. 返回创建缓冲区的代码,然后查看其中是否有任何功能失败。 I would suspect that a functions return status is not being correctly checked before the code continues. 我怀疑在代码继续之前没有正确检查函数的返回状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM