Jump to content
Tuts 4 You
Sign in to follow this  
xSRTsect

CreateDIBSectiob() from bitmap resouce

Recommended Posts

xSRTsect

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.


Share this post


Link to post
xSRTsect

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 (see edit history)

Share this post


Link to post

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
Sign in to follow this  
×
×
  • Create New...