user4344762
user4344762

Reputation:

How to handle PostMessage() failing?

I want to send a message to the UI thread using PostMessage(), and I need to guarantee that the message is actually sent. However, PostMessage() can fail, so how should I handle the case when it fails, should I place it in a while loop that does not exit until PostMessage() returns success?

Upvotes: 1

Views: 217

Answers (1)

Lightness Races in Orbit
Lightness Races in Orbit

Reputation: 385405

Since you can't guarantee delivery, as you indicate yourself, you need to instead decide how bad failure is. It sounds pretty critical, so I'd simply terminate the app. What else could you do?

Upvotes: 2

Related Questions