Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi EAccessViolation abfangen (https://www.delphipraxis.net/66442-eaccessviolation-abfangen.html)

Christian Seehase 30. Mär 2006 18:24

Re: EAccessViolation abfangen
 
Moin Andreas,

Du hast auch die Hilfe zu ClassType gelesen?

Zitat:

Zitat von OH - ClassType
Avoid using ClassType in application code.
In Delphi code, use the is or as operators instead of ClassType.

Ausserdem hast Du das Problem, dass Du Dir eine AV einhandelst, wenn MarkedPanel = nil ist, oder einen ungültigen Pointer enthält.

Andreas L. 30. Mär 2006 19:11

Re: EAccessViolation abfangen
 
Zitat:

Zitat von Christian Seehase
Moin Andreas,

Du hast auch die Hilfe zu ClassType gelesen?

Zitat:

Zitat von OH - ClassType
Avoid using ClassType in application code.
In Delphi code, use the is or as operators instead of ClassType.

Ausserdem hast Du das Problem, dass Du Dir eine AV einhandelst, wenn MarkedPanel = nil ist, oder einen ungültigen Pointer enthält.

Und wie soll das mit den is-Operator gehen?

Delphi-Quellcode:
if MarkedExPanel.ClassType is TPanel then

3_of_8 30. Mär 2006 19:14

Re: EAccessViolation abfangen
 
Genau. Denn wenns nicht instantiiert ist, ist es auch kein Panel, sondern nur ein Pointer ins nirgendwo.

Hawkeye219 30. Mär 2006 19:18

Re: EAccessViolation abfangen
 
Christian Seehase hat's in Beitrag #6 beschrieben...

Andreas L. 30. Mär 2006 19:33

Re: EAccessViolation abfangen
 
Ok, funktioniert. Nochmal Vielen Dank an alle


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:38 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz