Click here to Skip to main content
15,917,859 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Multithreading using AfxBeginThread Pin
Eugen Podsypalnikov1-Apr-10 5:39
Eugen Podsypalnikov1-Apr-10 5:39 
GeneralRe: Multithreading using AfxBeginThread Pin
kartikthakre1-Apr-10 7:17
kartikthakre1-Apr-10 7:17 
AnswerRe: Multithreading using AfxBeginThread Pin
David Crow1-Apr-10 7:53
David Crow1-Apr-10 7:53 
GeneralRe: Multithreading using AfxBeginThread Pin
kartikthakre2-Apr-10 3:54
kartikthakre2-Apr-10 3:54 
QuestionHow to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 7:10
professionalbioan31-Mar-10 7:10 
AnswerRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger31-Mar-10 7:31
professionalChris Losinger31-Mar-10 7:31 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 7:58
professionalbioan31-Mar-10 7:58 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger31-Mar-10 8:06
professionalChris Losinger31-Mar-10 8:06 
casting is correct.

but yes, it's also true that you need to find the start of the pixel data in the DIB, and that depends on the number of colors in the palette, any padding, any bitfields masks, etc..

LPBITMAPINFOHEADER      lpbi = (LPBITMAPINFOHEADER)pDIB;
HBITMAP                 hbm;
// how many colors in this DIB?
int nColors = lpbi->biClrUsed ? lpbi->biClrUsed : 
1 << lpbi->biBitCount;
	
BITMAPINFO &bmInfo = *(LPBITMAPINFO)pDIB ;
LPVOID lpDIBBits;
if( bmInfo.bmiHeader.biBitCount > 8 )
{
	lpDIBBits = (LPVOID)((UINT32 *)(bmInfo.bmiColors + 
	bmInfo.bmiHeader.biClrUsed) + 
	((bmInfo.bmiHeader.biCompression == BI_BITFIELDS) ? 3 : 0));
}
else
{
	lpDIBBits = (LPVOID)(bmInfo.bmiColors + nColors);
}

void *ppvBits = NULL;
hbm = CreateDIBSection(hDC,
		   (LPBITMAPINFO)lpbi,
		   DIB_RGB_COLORS,
		   &ppvBits,
		   NULL,
	   0);
		
// copy DIB pixels...
if (ppvBits!=NULL)
{
    memcpy((BYTE *)ppvBits, (BYTE *)lpDIBBits, bmInfo.bmiHeader.biSizeImage);
}


GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 8:23
professionalbioan31-Mar-10 8:23 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger31-Mar-10 8:30
professionalChris Losinger31-Mar-10 8:30 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 8:39
professionalbioan31-Mar-10 8:39 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger31-Mar-10 9:08
professionalChris Losinger31-Mar-10 9:08 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 9:38
professionalbioan31-Mar-10 9:38 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger31-Mar-10 9:46
professionalChris Losinger31-Mar-10 9:46 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 9:58
professionalbioan31-Mar-10 9:58 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger31-Mar-10 10:07
professionalChris Losinger31-Mar-10 10:07 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 10:22
professionalbioan31-Mar-10 10:22 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger31-Mar-10 10:30
professionalChris Losinger31-Mar-10 10:30 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 10:37
professionalbioan31-Mar-10 10:37 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan31-Mar-10 10:59
professionalbioan31-Mar-10 10:59 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger31-Mar-10 16:42
professionalChris Losinger31-Mar-10 16:42 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
bioan1-Apr-10 22:50
professionalbioan1-Apr-10 22:50 
GeneralRe: How to extract the bitmap (HBITMAP) from a BITMAPINFOHEADER variable? Pin
Chris Losinger2-Apr-10 1:15
professionalChris Losinger2-Apr-10 1:15 
QuestionGetRegValue and using it correctly, need help. Pin
rbwest8631-Mar-10 7:08
rbwest8631-Mar-10 7:08 
AnswerRe: GetRegValue and using it correctly, need help. Pin
Richard MacCutchan31-Mar-10 7:31
mveRichard MacCutchan31-Mar-10 7:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.