I'm practicing MFC multithreaded programming, a dialog window for different customers in different threads, communication between them like qq group to speak, the server (using CSocket communication) program can return all dialogue (to see) on all customer interface; Another dialog program () is used to establish different customer window, use AfxBeginThread (RUNTIME_CLASS (CChatThread) start the thread (CChatThread) of different customers, in InitInstance start CSocketClient, and each thread in the small window (CChatDlg) is the dialogue window, can send messages, and other window CChatDlg is a non-modal window, now do not know how can I get a CChatThread (CSocketClient) in the variable? CChatThread was established separate interface thread, not one of them the theApp global variables, try to send this pointer to CChatThread CChatDlg has been an error, if use a message and feel it is difficult to send a message (CChatDlg and CChatThread), please teach predecessors in the BBS, this situation should be how to design?
CodePudding user response:
CChatThread * p=(CChatThread *) AfxBeginThread (RUNTIME_CLASS (CChatThread), XXXX)