
Serial Port and Device Control Block Help
Need some urgent help with initializing of the Device Control Block
(DCB) for serial communications.
I based my code on the Dan Appleman example(CommDemo) for a serial
device which has 9600baud rate, RTS/CTS handshaking, 7 data bits, 1
stop bit and even parity
The code below was used to initialize the DCB however, when the API
function SetCommState is called the device is not responding(this is
before we even send the command to establish a link).
The initialize code is below, any help would be great thanks:
Private Sub Class_Initialize()
' The structure length must always be set
DCB.DCBlength = Len(DCB)
' Set some default values
BufferSize = 1024
' fBinary = 1
fParity = 1
fOutxCtsFlow = 1
fOutxDsrFlow = 1
fDtrControl = 1
fDsrSensitivity = 1
fTXContinueOnXoff = 0
fOutX = 0
fInX = 0
fErrorChar = 1
fNull = True
fRtsControl = 1
fAbortOnError = 1
DCB.XonLim = 100
DCB.XoffLim = BufferSize - 100
DCB.ByteSize = 7
DCB.Parity = 2
DCB.StopBits = 0
DCB.XonChar = 17
DCB.XoffChar = 19
DCB.ErrorChar = Asc("~")
DCB.EofChar = 26 ' ^Z
DCB.EvtChar = 255
' Set some default value
DCB.BaudRate = 9600
End Sub
Sent via Deja.com http://www.*-*-*.com/
Share what you know. Learn what you don't.