Skip to main content

Missing Messages



1 comment

  • Dapfor Team


    You are measuring different things. On the communication side, you call the SendMessage method. It should be understood that this method doesn’t send messages through the Windows MessageQueue but sends them directly to the graphical thread. The SendMessage call is blocking until the processing of the message (as opposed to PostMessage). From the GUI side, the graphical thread calls the Control.Invalidate (Rectangle). This method does not directly repaint the surface, but informs the system that need to be redrawn later. It should be noted that Invalidate() can be called multiple times. At some moment Windows decides it is necessary to redraw the surface and generates a WM_PAINT message, which you see in the DispatchMessage. Upon receiving this message the grid gets the region, which contains a collection of Rectangle, specified in Invalidate.

    Accordingly, the number of calls of the Invalidate can (and should) be greater than the amount WM_PAINT messages. The greater the CPU load, the greater must be the difference between the number of calls.

    As a consequence, in the case of high volatility of markets the method Invalidate() can be called multiple times for a single cell. At the same time, the cell will be redrawn only once with the latest data.  It should also be said that in Windows the minimum time between two neighboring WM_PAINT not be less than 15 ms. And the higher the CPU load, the less often it is coming.


    Best regards,



Please sign in to leave a comment.

Powered by Zendesk