c# SerialPort问题,请教,急!!急!!急 !!!
张军 2011-11-21 03:03:01 System.IO.Ports.SerialPort.Open()后出现以下错误
Open Port Exception: A device attached to the system is not functioning.
at System.IO.Ports.InternalResources.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.InternalResources.WinIOError()
at System.IO.Ports.SerialStream.InitializeDCB(Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Boolean discardNull)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
此为USB转Com,我用系统消息检测DeviceChange消息,当设备插入的时候判断是否为我要的设备,如是我需要的设备,则打开该串口,以上错误是我在打开串口时出现的异常,请教高人给个思路!!!
注:并不是每一次连接都会出现此问题,但一但出现此问题,则需停用该设备,再启用才行.