C++ Builder 5: Can't hang up analog modem running the program
Posted on 2009-06-29
I have made a program under C++ Builder 5 Enterprise that exchanges data with several remote locations. Som of them are reached via analog lines and modems. The communications modules are located in a different thread to avoid conflict with the main window thread. All the program runs well except for the task of hanging up the modem. I use some lines like:
If I run these lines with the debugger, step by step, it runs OK, but if I let the program run alone, the modem does not hang up and the line gets stuck.
I have tried to insert Sleep() between lines in case the task needed some delay but without success. Even tried to insert Application->ProcessMessages() but with the same negative result.
Can anyone tell me why it is not working and a way to definitely hang up the modem?
If the "+++" command does not work, could I use the method of resetting the UART so that the lines gets free?
Thank you very much in advance.