Private Type COMMCONFIG
dwSize As Long
wVersion As Integer
wReserved As Integer
dcbx As DCB
dwProviderSubType As Long
dwProviderOffset As Long
dwProviderSize As Long
wcProviderData As Byte
End TypePrivate Type COMMPROP
wPacketLength As Integer
wPacketVersion As Integer
dwServiceMask As Long
dwReserved1 As Long
dwMaxTxQueue As Long
dwMaxRxQueue As Long
dwMaxBaud As Long
dwProvSubType As Long
dwProvCapabilities As Long
dwSettableParams As Long
dwSettableBaud As Long
wSettableData As Integer
wSettableStopParity As Integer
dwCurrentTxQueue As Long
dwCurrentRxQueue As Long
dwProvSpec1 As Long
dwProvSpec2 As Long
wcProvChar(1) As Integer
End TypePrivate Type DCB
DCBlength As Long
BaudRate As Long
fBitFields As Long 'See Comments Win32API.Txt
wReserved As Integer
XonLim As Integer
XoffLim As Integer
ByteSize As Byte
Parity As Byte
StopBits As Byte
XonChar As Byte
XoffChar As Byte
ErrorChar As Byte
EofChar As Byte
EvtChar As Byte
wReserved1 As Integer 'Reserved - Do Not Use
End TypePrivate Declare Function GetCommConfig Lib "kernel32.dll" (ByVal hCommDev As Long, lpCC As COMMCONFIG, lpdwSize As Long) As LongPrivate Declare Function GetCommProperties Lib "kernel32.dll" (ByVal hFile As Long, lpCommProp As COMMPROP) As LongPrivate Declare Function GetCommModemStatus Lib "kernel32.dll" (ByVal hFile As Long, lpModemStat As Long) As LongPrivate Declare Function GetCommState Lib "kernel32.dll" (ByVal nCid As Long, lpDCB As DCB) As Long还有一些函数,获取com口信息