I have a wierd one. I am drawing a bitmap inside my WM_PAINT message and it will not show up.
But! If I call a message box within the WM_PAINT message (to check that WM_PAINT is being called) the bitmap will show up - but then I get a message box that I dont want.
case WM_PAINT:
{
if(bDataReceieved)
{
HBITMAP hBitmap;
PAINTSTRUCT ps;
char *tempImageArea;
hBitmap=CreateDIBSection(NULL,bmInfoHeader,DIB_RGB_COLORS,(void**)&tempImageArea,NULL,0);
SetDIBits(NULL,hBitmap,0,bmInfoHeader->bmiHeader.biHeight,bmPixelData,bmInfoHeader,DIB_RGB_COLORS);
HDC hDC=BeginPaint(hWnd,&ps);
if(hBitmap!=0)
{
HDC hdcMem=CreateCompatibleDC(hDC);
SelectObject(hdcMem,hBitmap);
BitBlt(hDC,0,0,bmInfoHeader->bmiHeader.biWidth,bmInfoHeader->bmiHeader.biHeight,hdcMem,0,0,SRCCOPY);
DeleteDC(hdcMem);
}
//MessageBox(0,"","",0);
EndPaint(hWnd,&ps);
}
}
break;
Any ideas as to where I am going wrong? I have even tried placing UpdateWindow(hWnd) all over the place, but still no good.
Thanks in advance!