Autor Beitrag
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Di 31.10.06 14:09 
Hi,
Ich habe diese Zeile Code:
ausblenden Delphi-Quelltext
1:
Audiofile := Playlist[i] as TAudiofile;					

AudiFile ist ein TAudioFile;
Playlist ist eine TStringlist;
Beim starten des Programms kommt diese Fehlermeldung:
Fehler hat folgendes geschrieben:
Operator ist auf diesem Operandentyp nicht anwendbar

Das versteh ich jetzt nicht ganz. Die Hilfe hat auch nichts gebracht was mir nützlich ist :(
Was muss man anders machen :?:
Leuchtturm :wave:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 31.10.06 14:13 
Von welchem Typ ist das Array Playlist? Ansonsten probiere mal einen Typecast:
ausblenden Delphi-Quelltext
1:
Audiofile := TAudioFile(Playlist[i]);					

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Di 31.10.06 14:16 
Gut jetzt startet das Programm erstmal :wink:
Allerding kommt beim Speichern jetzt ne Zugriffsverletzung;
Ich weiß aber nicht an was das liegen könnte

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 31.10.06 14:20 
Debugger benutzen. ;) Mit F7 die Zeile lokalisieren. ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Di 31.10.06 14:22 
Moin!

Playlist[i] ist vom Typ String, wenn TAudiofile nicht auch ein String ist, kann das nicht klappen... ;)

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 31.10.06 14:31 
Du solltest dir eine TObjectlist zulegen, in der du die ganzen Audiofiles verwaltest. Wie du das dann in eine Listendarstellung in der GUI reinpackst ist egal. Ich habe bei meinem Player einen VirtualStringTree zur Anzeige.

_________________
We are, we were and will not be.
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Di 31.10.06 14:37 
Das funktioniert dann soweit :zustimm:
Dafür funktioniert der ganze Rest mit den Strings nicht mehr :lol:
Was muss man da jetzt wieder ändern :?: :?: :?:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Mo 06.11.06 17:10 
Weiß dass jemand ich habe jetzt die ganze Zeit versucht, gesucht und nichts gefunden :lol:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Mo 06.11.06 17:24 
Poste mal bitte entsprechenden Code mit Fehlerquelle und Fehlerbeschreibung. ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Mo 06.11.06 17:54 
Das ist der Fragliche Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.SaveM3U(filename: String);
var
Playlist: TStringlist;
aAudioFile: TAudiofile;
i: Integer;
begin
      Playlist := TStringList.Create;
      Playlist.Add('#EXTM3U');
      for i := 0 to JvPlayList1.Count - 1 do
      begin
        aAudiofile := TAudioFile(Playlist[i]);
        Playlist.add('#EXTINF:' + IntTostr(aAudiofile.Dauer) + ','
              + aAudioFile.Artist + ' - ' + aAudioFile.Titel);
        Playlist.Add(ExtractRelativePath(FileName, aAudioFile.Pfad ));
      end;
      Playlist.SaveToFile(FileName);
      Playlist.Free;
end;

so rufe ich die prozedure auf:
ausblenden Delphi-Quelltext
1:
if SaveDialog1.Execute then SaveM3U(SaveDialog1.FileName);					


Fehler:
WEnn ich speichern will kommt eine Zugriffsverletzung:
Zitat:
Zugriffsverletzung bei Adresse 00404873 in Modul 'Player.exe'. Lesen von Adresse FFFFFFFF

Wenn ich Playlist als ObjectList deklariere und erzeuge kommt bei den ganzen Strings ein Fehler z.B.:Playlist.Add('#EXTM3U');

Gut so? :wink:

Leuchtturm :wave:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 06.11.06 18:17 
Was ist denn "Playlist"? Ist das die lokale Variable, in die Stings reinkommen, um sie in die m3u-Datei zu speichern, oder ist das die globale Playlist, in der Objekte vom Typ TAudiofile drin sind?

_________________
We are, we were and will not be.
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Mo 06.11.06 18:23 
'Playlist' ist nicht die Liste mit den TAudiofile-objekten, dass ist 'JvPlaylist1' :wink:
Plylist ist die lokale Stringlist in die die String reinkommen um in der *.m3u-Datei abgespeichert zu werden :wink:
Leuchtturm

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 06.11.06 18:25 
Dann ist diese Zeile falsch ;-)
ausblenden Delphi-Quelltext
1:
aAudiofile := TAudioFile(Playlist[i]);					

_________________
We are, we were and will not be.
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Mo 06.11.06 18:29 
Wenn ich aber dass Audiofile := Playlist[i] as TAudiofile; hin schreibe kommt das es der Operator auf diesem Operandentyp nicht anwendbar ist.
:nixweiss:
Da wären wir wieder am anfang :lol:
Was muss ich statt der Zeile einsetzten :?:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 06.11.06 18:44 
user profile iconLeuchtturm hat folgendes geschrieben:
'Playlist' ist nicht die Liste mit den TAudiofile-objekten, dass ist 'JvPlaylist1'

user profile iconGausi hat folgendes geschrieben:
Dann ist diese Zeile falsch ;-)
ausblenden Delphi-Quelltext
1:
aAudiofile := TAudioFile(Playlist[i]);					


Dämmerts? ;-)

_________________
We are, we were and will not be.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Mo 06.11.06 19:18 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
      Playlist := TStringList.Create;  
      Playlist.Add('#EXTM3U');  
      for i := 0 to JvPlayList1.Count - 1 do  
      begin  
        aAudiofile := TAudioFile(Playlist[i]);

Das macht eh keinen Sinn. Du fügst 1 Eintrag zur Stringlist und willst auf alle von JvPlayList zugreifen - das kann nur eine Zugriffsverletzung geben [außer JvPlayList1.Count wäre gerade 1]. Aber überleg mal, was Gausi dir sagen will xD.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Leuchtturm Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Di 07.11.06 14:29 
user profile iconGausi hat folgendes geschrieben:
user profile iconLeuchtturm hat folgendes geschrieben:
'Playlist' ist nicht die Liste mit den TAudiofile-objekten, dass ist 'JvPlaylist1'

user profile iconGausi hat folgendes geschrieben:
Dann ist diese Zeile falsch ;-)
ausblenden Delphi-Quelltext
1:
aAudiofile := TAudioFile(Playlist[i]);					


Dämmerts? ;-)

ich glaube ja :oops: :
allerdings muss ich jetzt noch eine Eigenschaft hinzufügen, welche???
So habe ichs jetzt probiert:
ausblenden Delphi-Quelltext
1:
aAudiofile := TAudioFile(JvPlaylist1.Items.Strings[i]);					

Da gibts aber wieder ne Zugriffsverletzung :?:

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 07.11.06 15:48 
Warum packst du denn wieder die Strings da rein? Ein String kann doch kein TAudioFile sein. und wenn JvPlaylist wirklich eine TObjectlist ist, dann sollten die einzelnen Objekte per TAudioFile(JvPlaylist[i]) ansprechbar sein...

_________________
We are, we were and will not be.
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Di 07.11.06 15:53 
Nicht ganz, aber so sollte man auf die Objekte zugreifen können: JvPlaylist1.Items.Objects[0];

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Gausi
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8554
Erhaltene Danke: 481

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 07.11.06 15:59 
Nope, meins geht auch. Deins aber nicht. Ich gehe von einer TObjectlist aus, die in der Eigenschaft "Items" die Objektreferenzen speichert. "Items.Objects[i]" gibts da nicht, höchstens "Items[i]" und dabei gilt:
Aus der Delphi-Hilfe:
In Delphi ist Items die Standardeigenschaft von TObjectList. Der Eigenschaftsname braucht deshalb nicht angegeben zu werden.

Wenn du natürlich eine Stringlist mit dranhängenden Objekten als Grundlage nimmst, muss man dagegen deinen Code nehmen.

_________________
We are, we were and will not be.