Autor Beitrag
jjturbo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Fr 05.11.04 11:06 
Moin Forum,

worin liegt das Problem, wenn ich folgenden mehrmals aufrufe:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
procedure TForm1.Button1Click(Sender: TObject);
begin
  MyJPEG:=TJPegImage.Create;
  MyJPEG.LoadFromFile(FileListBox1.Items[FileListBox1.ItemIndex]);
  Image1.Picture.Bitmap.Assign(MyJPEG);
  MyJPEG.Free;
end;


Das erste mal gehts gut, danach bekomme ich eine Acces violation...
:?

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Fr 05.11.04 18:04 
Hallo

ich seh keine AV. Aber warum ist myjpeg global? wo genau siehtst du die AV und ist sichergestellt, das in der FileListBox auch immer etwas ausgewählt ist? FileListBox1.ItemIndex solltest du auf <>-1 prüfen.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
jjturbo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 516

Win2000 prof., WinXP prof.
D4 Stand., D5 Prof, D7 Prof, D2007 Prof.
BeitragVerfasst: Sa 06.11.04 18:41 
War ein ziemlich dummer Fehler. Hatte irgendwo anders im Quelltext noch ein paar Zeilen:
ausblenden Delphi-Quelltext
1:
2:
3:
IrgendeinJpeg := MyJPEG;
...
IrgendeinJpeg.Free;


Das macht mir wohl so schnell keiner nach :oops:

Danke an alle, die sich den Kopf darüber zerbochen haben...
jjturbo

_________________
Windows XP: Für die einen nur ein Betriebssystem - für die anderen der längste Virus der Welt...