Mega Search
23.2 Million


Sign Up

Make a donation  
How to prevent Delphi from intercepting VCL exceptions gener  
News Group: borland.public.delphi.ide.general

Hi. I have written a COM DLL in C++Builder,
using VCL components. A client who is using Delphi is 
having a problem with it. The relevant piece of code is:

    try { animProgress->ResHandle = (UINT)_Module.GetResourceInstance(); }
        catch(Exception &e) {
            animProgress->ResId = 123;
        }

Now, an exception is always thrown when ResHandle is set.
(This is QC bug 42967). My code is a workaround for the bug
mentioned in the QC, which I wrote well before the QC entry
was written. This workaround works; the animation
gets loaded correctly.

However, when my DLL is being used by the
Delphi client, a dialog pops up for the exception. Somehow,
Delphi is intercepting the VCL exception and displaying the
message, instead of just letting my catch handler catch it without comment.
(The message is of course "Cannot open AVI").

After the dialog is dismissed, the code resumes working
correctly. 

The client obviously does not want to see this dialog.
What do they need to do in their Delphi project to prevent it
from intercepting exceptions internal to my code like this?

I'm aware that I could implement a different workaround, as
suggested in QC42967, to prevent the exception even being
thrown in the first place. But I would like to know how to 
prevent Delphi from intercepting exceptions anyway, as there
will be cases elsewhere in my application where exceptions
are thrown and I catch them and they should not leak out.

(In C++Builder, if I am running the COM object in the IDE, and I
configure the IDE to catch VCL exceptions, then the IDE 
intercepts the exception and displays the same message; but 
nothing is displayed when I am running a C++builder-written 
application outside of the IDE that calls this function).


Vote for best question.
Score: 0  # Vote:  0
Date Posted: 8-Jan-2008, at 8:07 PM EST
From: Old Wolf
 
Re: How to prevent Delphi from intercepting VCL exceptions g  
News Group: borland.public.delphi.ide.general
"Gerrit Beuze"  wrote in message 
news:47848958@newsgroups.borland.com...

> Later D2005 and newer allow defining a list of exception classes to 
> ignore.

Delphi has always had such a feature, and there is a UI for it in the 
Debugger Options dialog.  You do not need to modify the Registry manually.


Gambit 



Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 9-Jan-2008, at 10:28 AM EST
From: Remy Lebeau \(TeamB\)
 
Re: How to prevent Delphi from intercepting VCL exceptions g  
News Group: borland.public.delphi.ide.general
"Old Wolf"  wrote in message 
news:47844886$1@newsgroups.borland.com...

> However, when my DLL is being used by the Delphi client, a dialog
> pops up for the exception. Somehow, Delphi is intercepting the VCL
> exception and displaying the message, instead of just letting my catch
> handler catch it without comment.

The only way a popup dialog can appear is if your client code is running 
inside the IDE debugger, since the debugger catches all exceptions before 
the code does.  If the code is not running inside the debugger, then there 
is no way a popup dialog can appear.


Gambit 



Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 9-Jan-2008, at 10:26 AM EST
From: Remy Lebeau \(TeamB\)
 
Re: How to prevent Delphi from intercepting VCL exceptions g  
News Group: borland.public.delphi.ide.general
Old Wolf schrieb:
> Hi. I have written a COM DLL in C++Builder,
> using VCL components. A client who is using Delphi is 
> having a problem with it. The relevant piece of code is:
> 
>     try { animProgress->ResHandle = (UINT)_Module.GetResourceInstance(); }
>         catch(Exception &e) {
>             animProgress->ResId = 123;
>         }

Please, also post the code of the Delphi implementation. To find out 
what's wrong we need to know what it actually does.

-- 
Mohandas K. Gandhi often changed his mind publicly.  An aide once asked
him how he could so freely contradict this week what he had said just
last week.  The great man replied that it was because this week he knew
better.

....und wech
          Danny 

Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 9-Jan-2008, at 6:57 AM EST
From: ISO-8859-1QDanny_StrFCmpel
 
Re: How to prevent Delphi from intercepting VCL exceptions g  
News Group: borland.public.delphi.ide.general
Hi,

> thrown in the first place. But I would like to know how to
> prevent Delphi from intercepting exceptions anyway, as there
> will be cases elsewhere in my application where exceptions
> are thrown and I catch them and they should not leak out.

Later D2005 and newer allow defining a list of exception classes to ignore.
These are defined in
HKEY_CURRENT_USER\Software\Borland\BDS\5.0\Quality Insight
in a string value named
"Ignore Exception Classes" (omit quotes)

A typical string value would be
"EFOpenError;EFilerError"

I add my own exception base class EMMToolsException
EFOpenError;EFilerError;EMMToolsException

and derive all exceptions that should go unnoticed from this exception.
For lower IDE versions I have no idea.

Gerrit Beuze
ModelMaker Tools 



Vote for best answer.
Score: 0  # Vote:  0
Date Posted: 9-Jan-2008, at 3:25 AM EST
From: Gerrit Beuze