WM_PAINT and DX12

Viewed 397

Hi!

Could someone anwser my question, please? My program has one thread for the window's message loop and another for D3D12 rendering. Everything is fine, but the question is what window proc. should do with WM_PAINT? Currently the app has such fragment of code:

case WM_PAINT:
    return 0;

Is there any better/more efficient way, or that is OK?

1 Answers

Typically a Win32 render loop will have a trivial paint for those cases where the rendering isn't started or is halted for some reason (so you at least can't see 'junk' behind your window).

    {
    case WM_PAINT:
        {
            PAINTSTRUCT ps;
            (void)BeginPaint(hWnd, &ps);
            EndPaint(hWnd, &ps);
        }
        break;

...
   }

    return DefWindowProc(hWnd, message, wParam, lParam);
Related