![]() |
ExceptionHandling in der Projektdatei
Hallo zusammen
Ich möchte eine globale Fehlerbehandlung realisieren. Dazu setze ich direkt im dpr-File an:
Delphi-Quellcode:
Doch der ExceptionHandler wird nie aufgerufen. Warum? :gruebel:
program Project1;
uses Forms, SysUtils, Dialogs, Unit1 in 'Unit1.pas' {Form1}; {$R *.res} procedure GlobalExceptionHandler(Sender: TObject; E: Exception); begin ShowMessage('Globaler ExceptionHandler'); end; begin Application.Initialize; @Application.OnException:= @GlobalExceptionHandler; raise Exception.Create('Irgendein Fehler halt'); Application.CreateForm(TForm1, Form1); Application.Run; end. Gruss Shaman |
Re: ExceptionHandling in der Projektdatei
Gib der Application doch aus TForm.Create -- oder lass mal auf beiden Seiten das "@" weg.
|
Re: ExceptionHandling in der Projektdatei
Dann bringt er inkompatible Typen, weil GlobalExceptionHandler keine Methode ist...
|
Re: ExceptionHandling in der Projektdatei
Dann mach es zur Methode, z.B. in einer TForm, oder einer eigenen TApplication-Klasse.
|
Re: ExceptionHandling in der Projektdatei
Wenn eine Exception von einer Unit ausgelöst wird, funktioniert es, aber nicht wenn ein Fehler in der Projektdatei selber auftritt... :?:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:58 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz