Allowing the ProcessMessages
to continue even if it sends messages you don't want should not be classed as problematic. With a bit of code refactoring, you could move the buffering method into a separate thread and go from there.
If you are attempting to copy the "visual contents" of a control into a file,
- look at the WM_PRINT(xxx) message which allows child controls to paint themselves into bitmaps
- try the
LockWindowUpdate
Win32 API method call which will turn off all painting messages to that control
- override the
WndProc
/DefaultWndProc
method on your control class or even the parent class if you need to and simply return "true" for each message sent
- override specific control methods (such as "scroll bar moved", "
OnPaint
", "OnPaintBackground
" etc) on the control class or even the parent and simply do nothing if your buffering is in progress
Overriding the WndProc
or DefaultWndProc
and simply returning true for each message essentially "turns off" ProcessMessages
but it's not safe to do it this way because the control might need to process one or more messages to function correctly.
Turning off ProcessMessages
is not possible (without rewriting the VCL code for message processing) because of the fact that it's part of how the VCL form's message loop has been constructed.