Re: Focus problems on return from dialog ...

From: Dragon Lord (invalid_at_joke.com)
Date: 02/16/04


Date: Sun, 15 Feb 2004 23:29:23 -0500

You have to tell the DEBUGGER, not the CODE, you are TELLing the code.

The way exceptions work is

Raising an exception causes the exception dispatcher to go through the
following search for an exception handler:

1. The system first attempts to notify the process's debugger, if any.

2. If the process is not being debugged, or if the associated debugger does
not handle the exception, the system attempts to locate a frame-based
exception handler by searching the stack frames of the thread in which the
exception occurred. The system searches the current stack frame first, then
proceeds backward through preceding stack frames.

3. If no frame-based handler can be found, or no frame-based handler handles
the exception, the system makes a second attempt to notify the process's
debugger.

4. If the process is not being debugged, or if the associated debugger does
not handle the exception, the system provides default handling based on the
exception type. For most exceptions, the default action is to call the
ExitProcess function.

YOUR problem, is that it gets to the debugger FIRST, which is how exceptions
work, if you were to continue running the code, it would run fine. Putting
a billion try/excepts in doesn't change the fact that the debugger gets the
exception, before your exception handler gets it. YOU HAVE TO TELL THE
DEBUGGER TO IGNORE THAT EXCEPTION TYPE. Now, delphi organizes exceptions
into 2 areas, Language and OS. You can see this in the Tools->Debugger
Options. If you go into Language Exceptions, and add in EInvalidOperation,
the debugger will now ignore that exception and instead of stopping, it will
allow the program to continue on with its exception handler.

"pluton" <zielonadupa@poczta.onet.pl> wrote in message
news:c0ol20$s6m$1@news.onet.pl...
> > Most try and except blocks don't work when running under the debugger,
> this
> > is how exceptions work. The only thing you can do is tell the debugger
to
> > ignore that exception. Try and Except will work even for OS exceptions,
> > outside of the debugger.
>
> I put at least 715321543 try except blocks in my code.
> No effect.
>

Like I said, the debugger catches Exceptions BEFORE your try/except block
gets it to handle.

> Could you please tell me WHAT exception and WHERE should I intercept ?
> HOW to command application and debugger to ignore this exception innstead
> displaying this nasty message box ?
>

YOU don't intercept anything, the DEBUGGER intercepts Exceptions. Unless
you rewrite the debugger executable code, you don't have control over the
debugger code.
The Exception you need to ignore, is EInvalidOperation, like you specified
in your first message.

> Regards
> pluton
>
>

If you want more information about exceptions, start with "RaiseException"
in the Win32 SDK that comes with Delphi.

C:\Program Files\Common Files\Borland Shared\MSHelp\Win32.HLP

or if you DON'T have D6, its in "Help->Windows SDK" in the IDE.

Jeremy



Relevant Pages

  • Re: You wanted defensive writing...
    ... Couldn't you have set the debugger to break on all exceptions? ... > I've created an application that loads Caudill's TreeListView as its ... > I commented the line that called the insertion on start-up, ... > The exception caught me unaware, ...
    (microsoft.public.dotnet.csharp.general)
  • Re: You wanted defensive writing...
    ... Couldn't you have set the debugger to break on all exceptions? ... > I've created an application that loads Caudill's TreeListView as its ... > I commented the line that called the insertion on start-up, ... > The exception caught me unaware, ...
    (microsoft.public.dotnet.general)
  • Re: Problem with KITL?
    ... > Enable kernel debugger ... This OK if KdStub stumbling on its own BP. ... Exception in debugger, Addr=0x801AB864 - attempting to recover ...
    (microsoft.public.windowsce.platbuilder)
  • Re: 64b Windows - crashes not detected
    ... When you have the NULL pointer reference that should trigger an access violation, is it perhaps in a message handler that has come from a SendMessage call? ... a structured exception that would trigger an unwind to an exception handler back into kernel mode will simply be "swallowed" by the OS. ... If I understand you correctly, you are talking only about what gets trapped by the debugger, not what will be caught by exception handlers in your code. ...
    (microsoft.public.vc.mfc)
  • Re: Try..Except: How?
    ... stops execution when run under the debugger.. ... if you tell the debugger to allow your program to continue running. ... So far, it's just paused at the point of the exception to let you, the developer, inspect the state of your program and determine the error that caused the exception to be raised in the first place. ... When an exception occurs and your program displays a message box with the exception's message, that's a result of TApplication's default exception handler. ...
    (comp.lang.pascal.delphi.misc)

Loading