Solved

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

707 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

16 Experts available now in Live!

Get 1:1 Help Now