Solved

catching exceptions generated by ActiveX control I've drawn on screen

Posted on 1998-08-10
5
407 Views
Last Modified: 2010-04-04
I have an activeX control I put on my main form (drawn on in delphi IDE).  This happens to be the RealPlayer activex control, but that shouldn't be important to the question.   Occasionally, the control generates an exception.  I would like to use a Try/Except block to catch and handle or ignore the error.  The problem is, since it isn't really code I'm executing that causes it, but something asynchronous happening in the control that causes it, I can't figure out where the Try/Except would go to catch this exception.  
0
Comment
Question by:kdw
  • 3
5 Comments
 
LVL 3

Expert Comment

by:vladika
ID: 1361855
Try to use Application.OnException event
0
 

Author Comment

by:kdw
ID: 1361856
If I put something there, that basically does nothing but write to a log file, will the user still see the exception message, and will the program still exit after the exception?
0
 
LVL 3

Expert Comment

by:vladika
ID: 1361857
How wrote in the source

  if ExceptObject is Exception then
  begin
    if not (ExceptObject is EAbort) then
      if Assigned(FOnException) then
        FOnException(Sender, Exception(ExceptObject))
      else
        ShowException(Exception(ExceptObject));
  end else
    SysUtils.ShowException(ExceptObject, ExceptAddr);

So, if you assign OnException handler then message will not appear.
If you want show message
you can call Application.ShowException in the OnException
event handler.

0
 
LVL 3

Expert Comment

by:vladika
ID: 1361858
BTW, What do you mean "will the program still exit after the exception?"
Are program terminate after exception?
If yes, what kind of exception ActiveX generates?

0
 

Accepted Solution

by:
khenr29j earned 200 total points
ID: 1361859
The Realplayer control does not work well with the Delphi IDE.  I have confirmed this with theur tech support.  I recommend creating the controls at runtime to avoid problems. I had to do some stuff with Real Audio a couple of months ago and their activeX control is a real barebones component that dosn't expose much of the underlying API.  I ended up writing a Delphi implementation of it. It still has problems running in the IDE but at least I have the functionality I want. Contact my by e-mail at khenr29j@@paprika.mwc.edu (remove second @ sign) if you are interested in the Delphi translation.

To answer your question about AVs. To catch the error in the IDE requires wrapping the offending code in a Try ... Except clause.  As you noted, it is happening in the Real Audio code and there is nothing you can do to catch these errors as they happen behind the scenes without your code calling it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Virtualstringtree carsh after invalidate for while 5 87
delphi prevent click fast 2 192
FMX StringGrid1->Canvas->FillRect Problem 3 129
QRReport  TQrmemo vertical stretching 1 42
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

863 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now