MADExcept must catch Access Violation Only

contains all delphi packages mentioned below
Post Reply
hareram
Posts: 15
Joined: Wed Sep 08, 2010 6:45 am

MADExcept must catch Access Violation Only

Post by hareram »

Hi,

Currently MadExcept dialogue box appears for all unhandled exceptions. Is that possible to catch and display dialogue only for Access Violation Exception??

Please help! :(
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: MADExcept must catch Access Violation Only

Post by madshi »

Sure:

Code: Select all

uses madExcept;

procedure YourExceptionFilter(const exceptIntf: IMEException; var handled: boolean);
begin
  if exceptIntf.ExceptClass <> 'EAccessViolation' then
    handled := true;
end;

initialization
  RegisterExceptionHandler(YourExceptionFilter, stDontSync, epQuickFiltering);
end.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: MADExcept must catch Access Violation Only

Post by madshi »

P.S: The above code will silently ignore all non-access-violations. If you want to get a normal message box for non-access violations, you can replace "handled := true" with "exceptIntf.GeneralShowSetting := ssSimpleBox".
hareram
Posts: 15
Joined: Wed Sep 08, 2010 6:45 am

Re: MADExcept must catch Access Violation Only

Post by hareram »

Hi,

Thanks for help. It works perfectly... :idea:
Post Reply