Autor Beitrag
Krull
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20


D7 Personal
BeitragVerfasst: So 13.03.05 12:00 
Moin!

wie kann ich einen Sound in den MediaPlayer laden, der in einem Ordner im Programmverzeichnis liegt?
Ich habe es so versucht, aber das geht nicht:
ausblenden Quelltext
1:
MP_Sound.Filename:=data/sound/sound.wav;					


MfG
Krull
demo88
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 160

Ubuntu 6.04, Win XP
Delphi 7
BeitragVerfasst: So 13.03.05 12:55 
Was meinst du mit Programmverzeichnis?

Meinst du
1: "C:\Programme\"
oder
2: Meinst du das Verzeichniss in dem dein Programm sich befindet??

Für 2:
ausblenden Delphi-Quelltext
1:
MP_Sound.Filename:=ExtractFilePath(Application.Exename)+'data/sound/sound.wav';					

oder
ausblenden Delphi-Quelltext
1:
MP_Sound.Filename:=ExtractFilePath(Paramstr(0))+'data/sound/sound.wav';					


Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.
Krull Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20


D7 Personal
BeitragVerfasst: So 13.03.05 18:16 
Ich meine das Verzeichnis, in dem sich mein Programm befindet.
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: So 13.03.05 18:19 
wie wärs damit
ausblenden Delphi-Quelltext
1:
MP_Sound.Filename:='data\sound\sound.wav';					


windows-pfade funktionieren nämlich nur mit backslashes... siehe DOS handbuch

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
Krull Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20


D7 Personal
BeitragVerfasst: So 13.03.05 18:38 
Hatte ich auch probiert, nur dann hat Delphi gemeckert.

Aber mit dem Tipp von demo88 klappts.


Vielen Dank für die Vorschläge! :)
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: So 13.03.05 19:45 
der tip von demo88 kann aber nicht funktionieren, da er genau wie du die slashes in die falsche richtung gemacht hat.

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: So 13.03.05 19:52 
user profile iconretnyg hat folgendes geschrieben:
(...) da er genau wie du die slashes in die falsche richtung gemacht hat.

Das ist unter Windows egal (zumindestens XP, die anderen kann ich grad nicht nachprüfen, dürfte aber genauso sein). Es funktioniert folgendes gleichermaßen:

ausblenden Delphi-Quelltext
1:
  ShellExecute(0, 'open', PChar(ExtractFilePath(ParamStr(0)) + '/bla/project1.exe'), '', '', SW_SHOW);					

ausblenden Delphi-Quelltext
1:
  ShellExecute(0, 'open', PChar(ExtractFilePath(ParamStr(0)) + '\bla\project1.exe'), '', '', SW_SHOW);					

ausblenden Delphi-Quelltext
1:
  ShellExecute(0, 'open', PChar(ExtractFilePath(ParamStr(0)) + '/bla\project1.exe'), '', '', SW_SHOW);					


Gruß,
raziel

_________________
JSXGraph
retnyg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2754

SNES, GB, GBA, CPC, A500, 486/66, P4/3.0HT: NintendOS, AmigaOS, DoS
Delphi 5, Delphi 7
BeitragVerfasst: So 13.03.05 19:56 
wenn es wirklich so ist, hätte ich einen guten grund windows xp zu löschen und wieder zu dos 6.22 zurückzukehren
das ist ... VERRAT :evil:

_________________
es gibt leute, die sind genetisch nicht zum programmieren geschaffen.
in der regel haben diese leute die regel...