Type of theme for drawing a background in a bitmap in MFC

I have a CFC MFC document / view C ++ application that does all of its drawing on an off-screen bitmap and then copies it to the CDC pointer in the OnDraw method. Over the past couple of days, I tried to place the drawing component in a separate workflow, so it does not stop the GUI. I seem to get a significant amount of MFC-related GDI statements when I do this, e, g,

VERIFY(::MoveToEx(m_hAttribDC, x, y, &point)

So a few questions;

  • Are there any problems using workflows with MFC and GDI?
  • Are there problems using streaming MFC GDIs?
  • Should GDI objects be declared locally in the stream?

Despite the resource / lock problem, the drawing stream has its own CDC and CBitmap, which it uses for the entire drawing, and only copies the bitmap back to the main stream when it has exclusive access through the mutex. The code was also tested using a direct call, and not as a separate thread, to prove that the problem is with threading.

+3
source share
2 answers

(, , , , GetDC, ReleaseDC), . , DC , , , , , .

Do GDI, ? , / . , , .

, :

, C/MFC.

+2
+1

Source: https://habr.com/ru/post/1720304/


All Articles