If you make a callback through Synchronize , this is normal, like most Delphi implementations:
- create a callback structure containing the callback and event descriptor
- add callback structure to locked global list
- post a post in the main thread to wake it from
WaitMessage or similar - waiting for an event to complete the callback
This may or may not be better than using raw window messages, for example:
- the callback list is checked in clearly defined places and, as such, is not much suitable for return problems.
- for the same reasons, it is certainly a little less productive.
- this can cause problems with modal windows and custom pop-up menus that allow you to send sent messages, but in some cases can bypass the processing of the synchronization list
As long as the callback processing should be delayed / canceled, and you can say for sure that it does nothing that could cause the processing of sent messages (as most window-related procedures do)! using SendMessage , with the appropriate parameter marshaling.
source share