I try to build a simple client that connect to server receive data and disply them in gui.
for this purpose,
– I run a tcp client on other thread(boost thread).
– when that data received tcp client call to a callback(boost::bind) function that responsibel to create dynamic contorol according to received data.
- after control creation my main thread locked?
why this happend?
only main thread can build control in MFC?
Gross Generalization: In a Windows application, all controls and windows must “run” in the main thread.
This means that all controls must be created within the main thread as well. The main thread is the thread in which the Message Pump runs. All Windows programs are event-driven, meaning Windows messages trigger all functionality. These messages are received and dispatched by a loop which pulls messages off of a queue and sends them to the controls for which they are intended. The messages for a single window’s controls all go to the same queue, and therefore all of the controls on a window must flow through a single thread.