I am upgrading an app from QBasic to VB6. This program interfaces with some hardware across a serial port and needs to send commands and receive data back.
In QBasic, this we did this by open the comport as a file in Random mode, and then used input and print commands to communicate with this file.
In VB6, my old code doesn't work. When a file is opened as Random, print and input are no longer supported. I looked at using put and get, but found that with strings, put is appending string length to the front of the output.
I next tried opening the file in Binary mode, and I was able to send data out the comm port succesfully (yippee!), but I'm now having trouble receiving data. In QBasic, I used the Loc function to determine how many bytes were in the buffer so I could determine if I should read the data or wait (or timeout, etc.). I have tried using both LOC and LOF under VB6, but they don't seem to be seeing any data in the buffer.
When I switch to Hyperterminal, communications work correctly, so I've ruled out the com port, cable, etc.
At this point, I would like to know how to determine how many bytes are in the buffer, as that would result in the fewest changes to my code. However, I'm open to just about any suggestion as to how I might get this to work. I've seen reference to MSComm, but I do not have this on my machine.
Thank you for your time. I appreciate whatever guidance you might offer.
In QBasic, this we did this by open the comport as a file in Random mode, and then used input and print commands to communicate with this file.
In VB6, my old code doesn't work. When a file is opened as Random, print and input are no longer supported. I looked at using put and get, but found that with strings, put is appending string length to the front of the output.
I next tried opening the file in Binary mode, and I was able to send data out the comm port succesfully (yippee!), but I'm now having trouble receiving data. In QBasic, I used the Loc function to determine how many bytes were in the buffer so I could determine if I should read the data or wait (or timeout, etc.). I have tried using both LOC and LOF under VB6, but they don't seem to be seeing any data in the buffer.
When I switch to Hyperterminal, communications work correctly, so I've ruled out the com port, cable, etc.
At this point, I would like to know how to determine how many bytes are in the buffer, as that would result in the fewest changes to my code. However, I'm open to just about any suggestion as to how I might get this to work. I've seen reference to MSComm, but I do not have this on my machine.
Thank you for your time. I appreciate whatever guidance you might offer.