Subject Exiting gracefully from lost connection error (335544721)
Author almfgingras

I am using FireBird 1.5 with Delphi 7 and InterbaseXpress components.

While running my application, some users who sometimes lose their
database connection due to poor network conditions. When that
happens, an EIBInterBaseError # 335544721 is raised in my
application, which is normal. Since the database connection is gone,
the program responds to this exception by terminating the
application. The problem is that in this condition, the program
always terminates with some other fatal exception that makes the OS
(Win XP) want to send an error report to Microsoft. Following is the
code I wrote in the OnException event handler of the application...

procedure TfmMain.AppException(Sender: TObject; E: Exception);
if (E is EIBInterBaseError)
and (EIBInterBaseError(E).IBErrorCode = 335544721) then begin

MessageDlg('Database connection lost!' + #13#10#10 +
'The application will now be terminated.', mtError, [mbOK], 0);

dmMain.dbCMMS.ForceClose; // Forcing database to close


Would anyone know how I can terminate the program gracefully without
the user being prompted to send an error report to Microsoft
whenever this exception occurs.

Thank you,