If you read furthur down the archive entry, you will see that Vertex's code isn't all correct.
"What is going on? The offsets for the DCB at offset 8 are bits not DWORDS."
After looking some more, it appears that you are already doing so.
"What is going on? The offsets for the DCB at offset 8 are bits not DWORDS."
Function openComport(comport, baudRate) Local dcbBaudRate, driverHandle, dcb If comport > 255 Or comport < 0 Then Return INVALID_HANDLE_VALUE EndIf Select baudRate Case 110 dcbBaudRate = CBR_110 Case 300 dcbBaudRate = CBR_300 Case 600 dcbBaudRate = CBR_600 Case 1200 dcbBaudRate = CBR_1200 Case 2400 dcbBaudRate = CBR_2400 Case 4800 dcbBaudRate = CBR_4800 Case 9600 dcbBaudRate = CBR_9600 Case 14400 dcbBaudRate = CBR_14400 Case 19200 dcbBaudRate = CBR_19200 Case 38400 dcbBaudRate = CBR_38400 Case 56000 dcbBaudRate = CBR_56000 Case 57600 dcbBaudRate = CBR_57600 Case 115200 dcbBaudRate = CBR_115200 Default Return INVALID_HANDLE_VALUE End Select driverHandle = apiCreateFile("COM"+comport, GENERIC_READ Or GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0) If driverHandle = INVALID_HANDLE_VALUE Then Return INVALID_HANDLE_VALUE Else apiSetupComm(driverHandle, 1024, 1024) dcb = CreateBank(28) PokeInt dcb, 00, 28 ; sizeof(DCB) PokeInt dcb, 04, dcbBaudRate ; current baud rate val = 1 ; Binary Mode (skip Eof check) If parityEnable = True Then val = val Or 2 ; Enable parity checking If protocol = DTR_CONTROL Then val = val Or 48 ; DTR Flow control on PokeByte dcb, 08, val val = 0 If protocol = RTS_CONTROL Then val = val Or 48 PokeByte dcb, 09, val PokeByte dcb, 18, dataBits ; number of bits/byte, 4-8 PokeByte dcb, 19, parityBit ; 0-4=no, odd, even, mark, space PokeByte dcb, 20, stopBits ; 0,1,2 = 1, 1.5, 2 apiSetCommState(driverHandle, dcb) apiSetCommMask(driverHandle, EV_TXEMPTY) EndIf FreeBank dcb Return driverHandle End Function
After looking some more, it appears that you are already doing so.
Any suggestions to fix or a alternative to change the com port settings from Blitzplus?
The com settings DO change because I've used Vertexes code. I'm not sure what your code to return the com settings actually returns.