开发者

CreateDIBSection is throwing, when trying to create cursor on Win

开发者 https://www.devze.com 2022-12-20 00:02 出处:网络
I am trying to create Cursor from png, and CreateDIBSection() is throwing. Follwoing is the snippet of code:

I am trying to create Cursor from png, and CreateDIBSection() is throwing.

Follwoing is the snippet of code:

HDC hdc = GetDC(NULL);
void* lpBits = NULL;
HBITMAP  hBitmap;
try
{
 hBitmap = CreateDIBSection(
  hdc,
  (BITMAPINFO*)&bi,
  0,
  &lpBits,
  NULL,
  (DWORD)0);
}

ReleaseDC(NULL, hdc);

As CreateDIBSection is throwing, the code to release DC is not getting executed. can you please let me know the p开发者_StackOverflowossible issue behind this?


You should make structure zeroed out:

ZeroMemory(&bi,sizeof(BITMAPV5HEADER));

Try out this link , it may help you :

http://support.microsoft.com/kb/318876

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号