2

I want to treat WM_PAINT message. But at first, I want to let system to do the default drawing, then I draw something else manually.

For example:

    case WM_PAINT:
        CallWindowProc(DefWndProcTabControl, hwnd, message, wParam, lParam);
        TabControlOnPaint(hwnd);
        return 0;

This works, but is not very good, since it flicks.

One possibility is to make the default drawing done in a memory DC. But I don't know how to do this if I use CallWindowProc(DefWndProcTabControl...).

Any suggestion for this?

user565739
  • 1,302
  • 4
  • 23
  • 46

1 Answers1

4

If the window you're painting supports it, use WM_PRINT or WM_PRINTCLIENT to do the default painting into a memory DC.

(Trying to do that via CallWindowProc is unlikely to work.)

RichieHindle
  • 272,464
  • 47
  • 358
  • 399
  • Would you give a little bit more explanation? I am not sure, but does `WM_PRINT` or `WM_PRINTCLIENT` "print" something on the screen to a (memory) DC? If so, how to use them to do the default drawing (which is not done yet and not shown on the screen). Thank you very much. – user565739 Apr 20 '13 at 20:10
  • 1
    @user565739: MSDN: "The WM_PRINT message is sent to a window to request that it draw itself in the specified device context". So you use `SendMessage` to send `WM_PRINT` to `hwnd`, passing it a memory DC, and it paints itself into that DC. – RichieHindle Apr 20 '13 at 20:12