Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Enterprise
Expertise: Intermediate
Jun 7, 2001



Building the Right Environment to Support AI, Machine Learning and Deep Learning


PostThreadMessage is a Win32 API used to post messages to threads. Usually, the message posted is a standard windows message with the window handle set to NULL.

When PostThreadMessage is used to post messages to a thread that has created a window, it is very likely that the posted messages will be lost. This is because UI threads are not always run by the primary message loop. For example, when a thread is showing a message box, it is running on the message loop supplied by the message box. This secondary message loop does not know how to handle the thread message (since its window handle is NULL) and it will be dropped.

So when posting messages to a UI threads, use PostMessage() instead and post messages to a window owned by that thread. Then the messages won
Rajesh Chathapuram
Thanks for your registration, follow us on our social networks to keep up-to-date