Sending message from working non-gui thread to the main window

Posted by bartek on Stack Overflow See other posts from Stack Overflow or by bartek
Published on 2010-04-01T18:30:25Z Indexed on 2010/04/01 18:33 UTC
Read the original article Hit count: 374

Filed under:
|

I'm using WinApi.

Is SendMessage/PostMessage a good, thread safe method of communicating with the main window? Suppose, the working thread is creating a bitmap, that must be displayed on the screen. The working thread allocates a bitmap, sends a message with a pointer to this bitmap and waits until GUI thread processes it (for example using SendMessage). The working thread shares no data with other threads.

Am I running into troubles with such design?

Are there any other possibilities that do not introduce thread synchronizing, locking etc. ?

© Stack Overflow or respective owner

Related posts about winapi

Related posts about multithreading