Sending a Message That Does Not Execute Immediately

From RAD Studio
Jump to: navigation, search

Go Up to Sending Messages

There are times you may want to send a message but you do not know whether it is safe for the target of the message to execute right away. For example, if the code that sends a message is called from an event handler on the target control, you may want to make sure that the event handler has finished executing before the control executes your message. You can handle this situation as long as you do not need to know the message result.

Use the Windows API call, PostMessage, to send a message to a control but allow the control to wait until it has finished any other messages before it handles yours. PostMessage takes exactly the same parameters as SendMessage.

For more information on the PostMessage function, see the Microsoft MSDN documentation.

See Also