开发者

CreateDIBSection is throwing, when trying to create cursor on Win

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜