Problems with WM_PAINT and threads