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
精彩评论