Click to See Complete Forum and Search --> : multi-threading


Sourav_ly
July 1st, 2011, 09:16 AM
In my gui, i need to perform two task simultaneous.One is send a file via serial port communication and other is display the status of communication on GUI as static text .Both done in a single button control.For this whether i need to create separate thread?
I try this without threading.First i send the some fixed size of file and then show the status and continue the same for full file size.But when i open other application like calculator,the status display going hangs.but the file transfer is progressed.

Help required

VictorN
July 1st, 2011, 09:46 AM
You should use additional thread(s) for serial communications. The best way (IMHO) would be using overlapped IO wirh a worker thread processing serial Input (read) and UI thread (with a message pump) processing serial Output (write)
See the example in Serial Port I/O (http://www.flounder.com/serial.htm)