Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


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

Don


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
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap