CreateDIBSection is throwing, when trying to create cursor on Win

Posted by Anaamika on Stack Overflow See other posts from Stack Overflow or by Anaamika
Published on 2010-02-15T06:43:00Z Indexed on 2010/03/25 16:03 UTC
Read the original article Hit count: 355

Filed under:
|
|

Hi,

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 possible issue behind this?

© Stack Overflow or respective owner

Related posts about createdibsection

Related posts about c++