If i queue a message with PostMessage (and it return true) can i be certain that eventually the window will process the message unless some catastrophic event happen?(something which will crash the program anyway)
Once posted messages don't disappear from the queue.
One of our products is a Windows service that uses Windows messages to communicate between threads and it relies on them heavily. So far the only problem we've seen is that if you post them too fast the queue just fills and doesn't accept more messages until someone starts draining the queue.
You can be certain that the message will be in the queue if the call to PostMessage()
succeeds.
PostMessage()
will fail if the receiving queue is full. MSDN says:
There is a limit of 10,000 posted messages per message queue. This limit should be sufficiently large. If your application exceeds the limit, it should be redesigned to avoid consuming so many system resources. To adjust this limit, modify the following registry key.
You can't be certain that posted messages will ever be processed because it's up to the other app to decide whether or not to pump its message queue.
This is being a little pedantic because in reality an app that doesn't ever pump its queues never gets run by anyone through a process of natural selection!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With