Home > Back-end >  With ReceiveBuffer IdUDPClient components, if use ShowModal shows another window, ReceiveBuffer exit
With ReceiveBuffer IdUDPClient components, if use ShowModal shows another window, ReceiveBuffer exit

Time:10-05

As title, excuse me this how to solve the problem? Title description is, in fact as long as it is when all network components in ReceiveBuffer ShowModal shows another window or a MessageBox is going to die and so on, this can be used to Show display window of the ways to solve, but cannot solve the MessageBox problem, I learn skills not jing, please grant instruction of higher education, thank you very much!

CodePudding user response:

Synchronization to the main thread, such as PostMessage processing custom message to the main window, messages are received MessageBox.

CodePudding user response:

Upstairs said to be standard practice? This is not too much trouble? All MessageBox operation in the main window, including OpenDialog a heap of window all to do so

CodePudding user response:

Said again, even in the main window of MessageBox will also block the ReceiveBuffer, display to ShowModal MessageBox is the same,

CodePudding user response:

This why want to use showmessage, this is showmodal form;
Use the message mechanism to deal with some alarm, and so on is not better?

CodePudding user response:

reference emptily reply: 3/f
said again, even in the main window of MessageBox will also block the ReceiveBuffer, display MessageBox is the same with ShowModal,

You ReceiveBuffer threads and the main thread is two threads, you are in ReceiveBuffer MessageBox or ShowModal, both of which are blocking function, message processing function blocks in their form, the message you PostMessage to the main thread, ReceiveBuffer then run, and you don't have more trouble, the method of implementation in your ReceiveBuffer thread form message loop, at the same time also can not block ReceiveBuffer,

CodePudding user response:

(reference 4 floor response:
the why should use showmessage, this is showmodal form;
Use the message mechanism to deal with some alarm, and so on is not better?

Please see # 1 post, I said is PostMessage, not ShowMessage,
  • Related