Detecting a disconnection in device

  • Kevin Quach

    Kevin Quach - 2012-06-28

    Hi all,

    I'm currently using the latest version of comport with Delphi 2010 and I was wondering if anyone can tell me how I could go about detecting or exception handling a Write to comport where the device has just been disconnected (removed) when a port connection has already been established.

    I tried using a try except for when writing to an open port as well as OnException and OnError but the application said there's an Error 5 with message WriteFile Function failed.

    Can anybody help me.


  • Anonymous - 2012-06-28

    That's your detection technique.  :-) Error 5 is all Windows tells you.


  • Kevin Quach

    Kevin Quach - 2012-06-28

    Then how would I go about adding an exception handling method to say when there is an error -> disconnect the comport and do not allow any more write until a connections is established again?

  • marcootz

    marcootz - 2014-04-03

    Do you find any solutions to this issue ?



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks