Errors inside ActiveX

Posted on 1998-10-24
Last Modified: 2010-04-06
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).
Question by:ymailhot
  • 3
LVL 20

Expert Comment

ID: 1344180
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.

Expert Comment

ID: 1344181
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 "

Expert Comment

ID: 1344182

Is there anybody out there ???

Author Comment

ID: 1344183
Sorry about the delay. Thank you for the code. This will be useful.

Accepted Solution

itamar earned 90 total points
ID: 1344184
So, I'll assume that you could grade my comment as an answer, right ?

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
code issue 8 130
creating threads in delphi 1 104
Delphi: Connect to running MS Outlook 4 84
When i run adoquery my application freezes 26 166
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question