Solved

Errors inside ActiveX

Posted on 1998-10-24
5
163 Views
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).
0
Comment
Question by:ymailhot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 20

Expert Comment

by:Madshi
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.
0
 
LVL 4

Expert Comment

by:itamar
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;
    begin
     try
         sEDate := datetostr(Date);//Records Date
         sETime := timetostr(Time);//Time of Error
         sScreen := screen.activeform.name;//Active Form
         sControl := screen.activecontrol.name;//Active Control
         sEClass := E.Classname;//Error Class

         assignfile(F,'c:\ErrorFile.txt');
         append(F);
         writeln(f,sEDate,' ',sETime,'',sScreen,'',sControl,         '',sEClass,' ',E.Message);
         closefile(f);

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

     end;//try-except
    end;

    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
    ross@stiix.com "
0
 
LVL 4

Expert Comment

by:itamar
ID: 1344182

Is there anybody out there ???
0
 

Author Comment

by:ymailhot
ID: 1344183
Sorry about the delay. Thank you for the code. This will be useful.
0
 
LVL 4

Accepted Solution

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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month6 days, 15 hours left to enroll

622 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