Solved

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

Posted on 1998-08-10
5
409 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi XE2 application frozen on Windows 10 10 311
Working with hours 3 57
update joined tables 2 46
how to make 2 step back? ..\..\ ExtractFilePath (paramstr(0)) 5 14
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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

772 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