'//win32 api constants
private const GENERIC_READ as Long = 0x80000000
private const uint GENERIC_WRITE = 0x40000000
private const int OPEN_EXISTING = 3
private const int INVALID_HANDLE_VALUE = -1;
private const int MAXBLOCK = 4096*4;//好像操作系统不支持这个值,任意值都一样
private const uint PURGE_TXABORT = 0x0001; // Kill the pending/current writes to the comm port.
private const uint PURGE_RXABORT = 0x0002; // Kill the pending/current reads to the comm port.
private const uint PURGE_TXCLEAR = 0x0004; // Kill the transmit queue if there.
private const uint PURGE_RXCLEAR = 0x0008; // Kill the typeahead buffer if there.
private const int EV_TXEMPTY = 0x0004;
private const int EV_BREAK = 0x0040; // BREAK received
private const int EV_ERR = 0x0080; // Line status error occurred