-
I am creating a program that will act like a veriphone terminal (similar to a credit card terminal). Once connected(using a modem), the server sends me an ENQ (enquiry) Then I am supposed to send a formatted string.Then it sends me a formatted string, and I send an ACK. Simple? If I knew how to use the Comm control. I can't seem to get the on comm event to recieve the data. Does anyone have an example, know of a book, or online tutorial that will help understand how to use this control? Point me in the right direction?
Thanks
[This message has been edited by RobertC (edited 02-01-2000).]
-
There is an example in the samples directory in both VB5 and 6. Search your hard drive for the MSCOMM directory. The example is within. It is a terminal program that communicates both directions. You can bypass the telephone lines by connecting a phone cable between two computers and bypassing the commands for dialing, etc.
-
I really don't have anything really handy, but maybe this might help:
I'm not going to get too in depth here, but here is how I would go about it. Your code may differ depending on if your hardware is capable of "handshaking" signals. Anywho:
With MSComm1
.CommPort = 1
.Settings = "9600,N,8,1"
'Following disables all handshaking
.DTREnable = False
.EOFEnable = False
.RTSEnable =
.Handshaking = comNone
.RThreshold = 1
.SThreshold = 0
.PortOpen = True
End With
Now this is pretty basic. As you may see, I've set RThreshold to 1, which means every time a single byte is recieved, OnComm() fires. If you know the number of bytes your hardware will receive at a time, use that number because its much more efficient. I set SThreshold to 0 meaning OnComm will never fire when a byte is sent. There is alot more to the MSComm especially with buffer management. It's not difficualt, but you probably need to take a look at Microsoft's Visual Basic 6.0 Controls Reference to see all the members of MSComm1. I don't know of any other good book references to look at involving MSComm.
Take it easy and if ya need more, lemme know.
------------------
HTH,
Philip
[email protected]
[This message has been edited by PhilipG (edited 02-02-2000).]