Errors inside ActiveX

I am using the TWebBroser ActiveX component. On occasion web pages trigger a EOleError. Is there a way to intercept these using a try/except somewhere. This type of error is rare and I want to cause the application to restart if it occurs (this is an unattended kiosk).
Who is Participating?
So, I'll assume that you could grade my comment as an answer, right ?
You should run the program in the Delphi IDE, so that Delphi can show you the location where the exception occurs. Then you can build a try..except around this location.

Regards, Madshi.
Hi ymailhot,

I extracted this from a previous question answered by bozo:

    Procedure AppException(Sender: TObject; E:Exception);

    The code for this procedure would look something like this

    Procedure TForm_Main.AppException(Sender: TObject; E: Exception);
    var sEDate,sETime : String;
        sScreen, sControl,sEClass: string;
        myfilehandle: integer;
        F: TextFile;
         sEDate := datetostr(Date);//Records Date
         sETime := timetostr(Time);//Time of Error
         sScreen :=;//Active Form
         sControl :=;//Active Control
         sEClass := E.Classname;//Error Class

         writeln(f,sEDate,' ',sETime,'',sScreen,'',sControl,         '',sEClass,' ',E.Message);

         messagedlg(E.Message,mtWarning,[mbok],0);//Shows user error
                MYFileHandle := FileCreate('c:\fooderor.txt');


    Then in your Oncreate of the main form add this line of code

     pplication.OnException := AppException;//

    Tells to use AppException Procedure

    Let me know if this doesn't work. It has worked for me in 4 different apps now. Some i use a table this one i use a text file
    to hold all the errors.

    bozo "

Is there anybody out there ???
ymailhotAuthor Commented:
Sorry about the delay. Thank you for the code. This will be useful.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.