displaying 24bit bitmap

lestard used Ask the Experts™
i got some array of bytes containing the rgb data for a 24 bit bitmap; i want to display it on the screen and therefor i copy the bitmap data to a CBitmap, create a memdc and select the bitmap into it. after that i copied it to screen by using BitBlt.
how can i tell windows to use 24 bit rgb colors and not convert it to b/w or half tone ?
creating some bitmap by using CreateBitmap (which allows you to specify the bits per pixel) instead of CreateCompatibleBitmap will always result in nothing being displayed.
i'm using mfc;
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
1) Fill BITMAPINFOHEADER structure with desired bitmap parameters
2) Call CreateDIBSection function passing pointer to BITMAPINFOHEADER
3) Copy your pixels array to ppvBits filled by CreateDIBSection
4) Select HBITMAP returned by CreateDIBSection in memory device context
5) BitBlt from memory device context to window device context

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial