Jump to content
Tuts 4 You

CreateDIBSectiob() from bitmap resouce


xSRTsect

Recommended Posts

Posted

Hello, I have the following code



//bitmap
HMODULE hModule = GetModuleHandle(NULL); HRSRC hRes = FindResource(hModule, pBitmapName, RT_BITMAP);
if (hRes == NULL)
return; HGLOBAL hGlb = LoadResource(hModule, hRes); if (hGlb == NULL)
return; BITMAPINFO * pDIB = (BITMAPINFO *)LockResource(hGlb); if (pDIB == NULL)
return; textbmi = *pDIB;
textDC = CreateCompatibleDC(mDC->GetSafeHdc());
textbmp = CreateDIBSection(textDC, &textbmi, DIB_RGB_COLORS, (LPVOID *)&lpTextBuffer, 0, 0);
SelectObject(textDC, textbmp);

Everything looks to execute properly without API null returns - however, lpTextBuffer points to an array of zeros, no my image is not a black bitmap.


Posted (edited)

Hello and thank you for the answer. I ended up accessing the data after the structure BITMAPINFOHEADER to find out it was my pixel data.


Edited by xSRTsect

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...