How to get WM_PAINT to fire at the time I need?

  • Thread starter Thread starter Purple_Apple
  • Start date Start date
P

Purple_Apple

Guest
Hello. I develop Win32 C++ application using Visual Studio 2017 Community. The main task of the application is to triangulate a set of points and draw a triangulation mesh. I need to draw a triangulation mesh already after the application window is displayed and the user clicks on "Triangulation Start" button located on the toolbar. In a specially defined thread, the coordinates of the edges of the triangles that make up the triangulation mesh are formed. A special GetEdgeCoords() function collects the values of these coordinates (for each edge, the coordinates of its starting and ending points are taken). Then, the coordinates of each edge are placed in concurrent_queu. I planned to poll this concurrent_queu in WM_PAINT and get the coordinates from concurrent_queu and draw edges on them using Graphics.DrawLine from GDI+. But I did not succeed because WM_PAINT is launched only once - when the application loads. Therefore, I simply cannot canonically use the WM_PAINT message to draw a triangulation grid. Therefore, I have a question. How to get WM_PAINT to start at the right time? Namely, when the GetEdgeCoords() function finds the coordinates of the next edge that needs to be drawn. Edges in triangulation can be a very large number. Say, for example, 10,000. Functions GetEdgeCoords() and WndProc() are in different threads. Can this be done? Thanks in advance.

Continue reading...
 
Back
Top