简单点,不用监听 Windows 消息,你可以用 SerialPort.GetPortNames(),每隔一段时间(比如 5 秒)就遍历一次所有串口,尝试在每个串口都和设备连接通信一次,如果连接通信正常,就 OK,否则释放资源。