Autor Beitrag
Cybo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 87

Win 95/98/xp/NT Suse Linux
D7 Ent
BeitragVerfasst: Mi 28.07.04 00:36 
Hi, ich möchte ein kleines Intro abspielen in einem Programm jedoch
ausblenden Delphi-Quelltext
1:
2:
MediaPlayer1.FileName :='intro.wav';
MediaPlayer1.Play;

funktioniert nicht. Ich muss den genauen Pfad angeben und damit kann das Programm ja nie bei anderen laufen. Wie kann ich es ereichen, dass die datei intro.wav aus dem selben verzeichnis wie das Hauptprogramm abgespielt wird?

Cybo

_________________
Ich öffnete, kompilierte und traute meinen Augen nicht.
highhatcompy
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win2000,Win XP,Linux(SuSE9.2)
Delphi 5 Prof.
BeitragVerfasst: Mi 28.07.04 05:34 
Hallo,

versuche es doch mit:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
...
// Es wir der Pfad und der Dateiname der Ausgeführten Datei gezeigt
Label1.Caption:=ParamStr(0);

// Es wird nur der Pfad gezeigt
Label2.Caption:=ExtractFilePath(ParamStr(0));

//Du könntest also schreiben
Mediaplayer1.FileName:=ExtractFilePath(ParamStr(0))+'intro.wav';
Mediaplayer1.Play;
...


Viele Grüße Highhatcompy

_________________
Bist Du ein Programmierer, so wirst Du gegen Computer, Hardwarehersteller und Anwender verlieren. (Quelle: Murphy's Computer-Gesetz)
Cybo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 87

Win 95/98/xp/NT Suse Linux
D7 Ent
BeitragVerfasst: Mi 28.07.04 09:59 
Mein neuer Verusch heute Nacht war :
ausblenden Delphi-Quelltext
1:
2:
3:
dir := ExtractFilePath(ParamStr(0));
MediaPlayer1.FileName :=dir+'intro.wav';
MediaPlayer1.Play;


geht aber auch nicht, dir ist natürlich oben deklariert.

Ich teste jetzt mal deinen Code.
Cybo

_________________
Ich öffnete, kompilierte und traute meinen Augen nicht.
Cybo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 87

Win 95/98/xp/NT Suse Linux
D7 Ent
BeitragVerfasst: Mi 28.07.04 10:04 
Den Pfad zeigt er richtig an... aber "kein MCI Gerät geöffnet/ oder konnte dateiendung keinem Programm zuordnen"

:( Die Delphihilfe bringt mich auch nicht weiter :-(

Cybo

_________________
Ich öffnete, kompilierte und traute meinen Augen nicht.
highhatcompy
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win2000,Win XP,Linux(SuSE9.2)
Delphi 5 Prof.
BeitragVerfasst: Mi 28.07.04 10:19 
Hallo,
du mußt vorher:
ausblenden Delphi-Quelltext
1:
2:
3:
...
Mediaplayer1.DeviceType:=dtAutoSelect;
...

oder
ausblenden Delphi-Quelltext
1:
2:
3:
...
Mediaplayer1.DeviceType:=dtWaveAudio;
...

schreiben!

HHC

_________________
Bist Du ein Programmierer, so wirst Du gegen Computer, Hardwarehersteller und Anwender verlieren. (Quelle: Murphy's Computer-Gesetz)
Cybo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 87

Win 95/98/xp/NT Suse Linux
D7 Ent
BeitragVerfasst: Mi 28.07.04 10:41 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
Mediaplayer1.DeviceType:=dtWaveAudio;
// Es wir der Pfad und der Dateiname der Ausgeführten Datei gezeigt
Label1.Caption:=ParamStr(0);
// Es wird nur der Pfad gezeigt
Label2.Caption:=ExtractFilePath(ParamStr(0));
//Du könntest also schreiben
Mediaplayer1.FileName:=ExtractFilePath(ParamStr(0))+'intro.wav';
Mediaplayer1.Play;


-> kein MCI Garät geöffnet :-( Ich versteh es einfach nicht...

Cybo

_________________
Ich öffnete, kompilierte und traute meinen Augen nicht.
highhatcompy
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 190

Win2000,Win XP,Linux(SuSE9.2)
Delphi 5 Prof.
BeitragVerfasst: Mi 28.07.04 10:43 
Hi,
und jetzt fehlt bestimmt noch:
ausblenden Delphi-Quelltext
1:
2:
3:
...
Mediaplayer1.Open;
...


Ich hoffe das wars!?

HHC

_________________
Bist Du ein Programmierer, so wirst Du gegen Computer, Hardwarehersteller und Anwender verlieren. (Quelle: Murphy's Computer-Gesetz)
Syngel Kid
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 61

Win XP
Delphi 2005
BeitragVerfasst: Mi 28.07.04 15:56 
Mensch, dass ist ja komplizierter als Daniel Düsentriebs Erfindungen! :D

Wieso nicht einfach ganz normal:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
MediaPlayer1.Close; // Erst mal schliessen, fals du noch ein Lied geladen hast...
MediaPlayer1.FileName := 'intro.wav'; // Danach FileName zuweisen,
MediaPlayer1.Open; // Den Player öffnen
MediaPlayer1.Play; // Und abspielen...
Cybo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 87

Win 95/98/xp/NT Suse Linux
D7 Ent
BeitragVerfasst: Mi 28.07.04 21:02 
Syngel Kid hat folgendes geschrieben:
Mensch, dass ist ja komplizierter als Daniel Düsentriebs Erfindungen! :D

Wieso nicht einfach ganz normal:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
MediaPlayer1.Close; // Erst mal schliessen, fals du noch ein Lied geladen hast...
MediaPlayer1.FileName := 'intro.wav'; // Danach FileName zuweisen,
MediaPlayer1.Open; // Den Player öffnen
MediaPlayer1.Play; // Und abspielen...


*Yeeepeee*

hatte das .open vergessen :-(

DANKE euch beiden...

Cybo

_________________
Ich öffnete, kompilierte und traute meinen Augen nicht.
Mister X-Ray
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 41

Win XP, Win 2000
D7 Pers, D2005 Pers
BeitragVerfasst: So 03.04.05 17:40 
ich hab das von oben so gemacht dass die .wav "auf Knopfdruck" (button1) abgespielt wird. Das funktioniert aber nur einmal !? Woran liegt das?

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.Button1Click(Sender: TObject);
begin
   MediaPlayer1.Close;
   MediaPlayer1.FileName := '1.wav';
   MediaPlayer1.Open;
   Mediaplayer1.DeviceType:=dtWaveAudio;
   MediaPlayer1.Play;
   MediaPlayer1.Close;
end;


Moderiert von user profile iconUGrohne: Code- durch Delphi-Tags ersetzt.