Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comport driver, USB converter errors

Status
Not open for further replies.

sggaunt

Programmer
Jul 4, 2001
8,620
GB
I use TCommport library for serial comms, all have been well until the advent of USB, what can happen with the driver is that if the USB connection is lost, the driver cannot cleanly close the Virtual Port.

The user sees an error message 'Purge comm function failed'

This isn't good, and usually the only way to get things going again is by restarting the application.

I have been following a forum on the sourceforges pages for the driver.


this is all fine except that the final code solution posted seems to me to close the port OK but leaves the exception unhandled, so the user will still see the 'purge comm failed message', I would like to replace this with something more meaningful.
Would this work?

Code:
 type
  EAbortErrror = class(Exception);

//--------------------------
try
    try
       AbortAllAsync;
    except
       raise EAbortError.Create('USB Connection Lost,    don''t panic');
     end
finally
   // stop monitoring for events  
   if FThreadCreated then
      begin
         etc...
      end
   // and close the port
end



Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top