Hi All, I am trying to implement double buffered drawing in a windows mobile application. But I still see the flickering. I am using InvalidateRect() in my rendering code(not shown here), instead of Updating the entire window. The rectangle mentioned in this API is flickering when I update/paint. Please help
case WM_PAINT:
{
hdc = BeginPaint(hWnd, &ps);
//hdc = GetDC(hWnd);
HDC newDC = CreateCompatibleDC(hdc);
HBITMAP hBitmap;
hBitmap = CreateCompatibleBitmap(hdc,width, height);
SelectObject(newDC,hBitmap));
BitBlt(hdc,0,0,width, height,newDC,0,0,SRCCOPY);
DeleteDC(newDC);
DeleteObject(hBitmap);
EndPaint(hWnd, &ps);
//ReleaseDC(hWnd,hdc); //Using this causes WM_PAIN fired without any reason.
}
break;