我正在尝试从png创建光标,而CreateDIBSection()抛出。
下面是一段代码:
HDC hdc = GetDC(NULL);
void* lpBits = NULL;
HBITMAP hBitmap;
try
{
hBitmap = CreateDIBSection(
hdc,
(BITMAPINFO*)&bi,
0,
&lpBits,
NULL,
(DWORD)0);
}
ReleaseDC(NULL, hdc);当CreateDIBSection抛出异常时,释放DC的代码不会被执行。你能让我知道这背后可能存在的问题吗?
发布于 2010-02-15 18:25:28
你应该使结构归零:
ZeroMemory(&bi,sizeof(BITMAPV5HEADER));
试试这个链接,它可能会对你有所帮助:
http://support.microsoft.com/kb/318876
https://stackoverflow.com/questions/2264374
复制相似问题