Allowing ProcessMessages to continue, even if it sends messages that you do not want, should not be classified as problematic. With a bit of code refactoring, you can move the buffering method to a separate thread and go from there.
If you are trying to copy the “visual content” of a control to a file,
- see the WM_PRINT (xxx) message, which allows child controls to draw in bitmaps
- try calling the
LockWindowUpdate Win32 API method, which will turn off all coloring messages to this control - override the
WndProc / DefaultWndProc in your control class or even the parent class if you need and simply return "true" for each message sent. - override certain control methods (such as "moving the scroll bar", "
OnPaint ", " OnPaintBackground ", etc.) in the control class or even the parent object and just do nothing if your buffering is done.
Overriding WndProc or DefaultWndProc and just returning true for each message is essentially “disabled” by ProcessMessages , but this is not safe for this, because management may require processing one or more messages to work correctly.
Disabling ProcessMessages not possible (without overwriting the VCL code for message processing) because it is part of how the VCL form message loop was configured.
source share