Hi. I'm having some problems making a listview (in report view) double-buffered. The code I have works fine (if you overlook the fact that it's allocating everything each time WM_PAINT is called,) but I can't seem to figure out how to draw the column headers. I'm assuming they're not actually part of the client area, but I've also tried various things involving WM_PRINTing PRF_NONCLIENT and similiar without much luck.
I'd really appreciate any hints!
The following is the code I currently have to paint the client area:
LRESULT CALLBACK LvPaintProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HDC hdc, hdcNew;
HBITMAP hbm, hbmOld;
hdc = BeginPaint(hWnd, &ps);
hdcNew = CreateCompatibleDC(hdc);
hbm = CreateCompatibleBitmap(hdc, ps.rcPaint.right, ps.rcPaint.bottom);
hbmOld = SelectObject(hdcNew, hbm);
hbr = CreateSolidBrush(GetBkColor(hdc));
FillRect(hdcNew, &ps.rcPaint, hbr);
SendMessage(hWnd, WM_PRINTCLIENT, (WPARAM)hdcNew, (LPARAM)PRF_CLIENT|PRF_CHILDREN);
BitBlt(hdc, 0, 0, ps.rcPaint.right, ps.rcPaint.bottom, hdcNew, 0, 0, SRCCOPY);
return CallWindowProc((WNDPROC)GetWindowLong(hWnd, GWL_USERDATA), hWnd, uMsg, wParam, lParam);