Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Prozedur löst exception aus... (https://www.delphipraxis.net/44113-prozedur-loest-exception-aus.html)

malo 13. Apr 2005 20:14


Prozedur löst exception aus...
 
Delphi-Quellcode:
procedure TEventClass.LoadEventsFromFile;
var
  i: integer;
  ini: TIniFile;
begin
  ini := TIniFile.Create(ExtractFilePath(Paramstr(0)) + 'Event.ini');
  for i := 0 to ndx do
    begin
      try
      Events[i].Name := ini.ReadString('Event' + IntToStr(i), 'Name', 'No Value');
      Events[i].Description := ini.ReadString('Event' + IntToStr(i), 'Description', 'No Value');
      Events[i].NotifyTime := ini.ReadInteger('Event' + IntToStr(i), 'NotifyTime', 0);
      Events[i].EventDateTime := ini.ReadDate('Event' + IntToStr(i), 'EventDateTime', 0);
      finally
      ini.free;
      end;
    end;
end;
diese Prozedur gibt mir eine Zugriffsverletzung im Speicher, und ich weiß nicht, warum das passiert. Hat jemand eine Ahnung? :?


PS: Es liegt nicht am Aufruf. Den Fehler dort hab ich bereits beseitigt :stupid:

alcaeus 13. Apr 2005 20:16

Re: Prozedur löst exception aus...
 
Versuchs mal mit
Delphi-Quellcode:
for i := 0 to ndx-1 do
Greetz
alcaeus

malo 13. Apr 2005 20:17

Re: Prozedur löst exception aus...
 
Zitat:

Zitat von alcaeus
Versuchs mal mit
Delphi-Quellcode:
for i := 0 to ndx-1 do
Greetz
alcaeus

Danke! :thumb:

Muetze1 13. Apr 2005 20:25

Re: Prozedur löst exception aus...
 
Moin!

Dir ist auch bewusst, das du nach dem ersten Durchlauf die TIniFile Instanz freigegeben hast um danach noch weiterhin drauf zu zu greifen bei den weiteren Durchläufen? Ich hoffe doch...

MfG
Muetze1

malo 13. Apr 2005 20:27

Re: Prozedur löst exception aus...
 
Zitat:

Zitat von Muetze1
Moin!

Dir ist auch bewusst, das du nach dem ersten Durchlauf die TIniFile Instanz freigegeben hast um danach noch weiterhin drauf zu zu greifen bei den weiteren Durchläufen? Ich hoffe doch...

MfG
Muetze1

:oops: Danke. Ich hab die Freigabe erst später eingefügt, weil ich das vorher vergessen hab (die Freigabe)... ;)


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:28 Uhr.

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