Autor Beitrag
JaketheSnake
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 149

XP
D5 Prof.
BeitragVerfasst: Fr 04.11.05 15:32 
Um *.wav dateien abzuspielen muss man SYNC in die uses liste dazugeben . Ich hab delphi 5 und ihrendwie gibt er mir immer so ne fehlermeldung , dass er SYNC.dcu nicht findet :evil: .
Muss man die ihrgentwo downloaden :?:
Wenn ja wo :?:

Schon ma danke für die Mühe

_________________
Good, better , best


Zuletzt bearbeitet von JaketheSnake am Fr 04.11.05 21:47, insgesamt 1-mal bearbeitet
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 04.11.05 18:22 
zeig doch mal den code mit dem du die wave datei abspielen willst...
denn das mit dem SYNC in die uses klausel,wäre mit neu !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
JaketheSnake Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 149

XP
D5 Prof.
BeitragVerfasst: Fr 04.11.05 18:49 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm4.Button1Click(Sender: TObject);
begin
     PlaySound(PChar('Test.wav'),SND_SYNC);
end;

_________________
Good, better , best
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 04.11.05 20:22 
nein der code geht auch so, da musst du kein SYNC in Uses mit aufnhemen. lösch das mal raus !

_________________
In the beginning was the word.
And the word was content-type: text/plain.
JaketheSnake Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 149

XP
D5 Prof.
BeitragVerfasst: Fr 04.11.05 20:33 
bei mir kommt jetzt eine Fehlermeldung :

[Fehler] Unit1.pas(35): Undefinierter Bezeichner: 'PlaySound'

Muss ich das vorher ihrgendwie deklarieren ?

_________________
Good, better , best
JaketheSnake Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 149

XP
D5 Prof.
BeitragVerfasst: Fr 04.11.05 21:14 
es sieht also immoment so aus :

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button2Click(Sender: TObject);
begin
     PlaySound(PChar('Test.wav');
end;

_________________
Good, better , best
Waldheini
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 32

Win 98SE, XP
D5 St., K3 Prof
BeitragVerfasst: Sa 05.11.05 00:46 
PlaySound ist eine Funktion aus der winmm.dll, die Du in deine Unit einbinden mußt:

ausblenden Delphi-Quelltext
1:
2:
3:
function PlaySound(pszSound:pchar;hmod:pointer;fdwSound:Cardinal):Boolean;
   cdecl;
   external 'winmm.dll' Name 'PlaySound';


pszSound = Dateiname der Wave Datei,
hmod = Nil
fdwSound = Modus

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
// Modus:

Const
   SND_SYNC         = 0     // synchron abspielen
   SND_ASYNC        = 1     // asynchron abspielen
   SND_NODEFAULT    = 2     // keinen System-Sound bei fehlerhaften Aufruf
   SND_MEMORY       = 4     // Sound-Wiedergabe aus dem Speicher (pszSound = Zeiger)
   SND_LOOP         = 8     // wiederholte Sound-Ausgabe
JaketheSnake Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 149

XP
D5 Prof.
BeitragVerfasst: Sa 05.11.05 11:49 
Sorry aber es funktioniert immer noch nicht :motz: :?!?: :bawling:

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

function PlaySound(pszSound:pchar;hmod:pointer;fdwSound:Cardinal):Boolean;   
   cdecl;   
   external 'winmm.dll' Name 'PlaySound';

Const
   SND_SYNC         = 0 ;   // synchron abspielen

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
begin
     close;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
      PlaySound(PChar('\media\Test.wav')0, 0);
end;

end.

_________________
Good, better , best
Waldheini
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 32

Win 98SE, XP
D5 St., K3 Prof
BeitragVerfasst: Sa 05.11.05 14:38 
Im Aufruf der Funktion PlaySound hast Du ein Komma vergessen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button2Click(Sender: TObject);  
begin  
      PlaySound(PChar('\media\Test.wav'), 0, 0);  
end;


Wenn die Datei, die Du abspielen willst, nicht existiert, sollte zumindest der Systemsound, der bei einem Fehler wiedergegeben wird, zuhören sein!
JaketheSnake Threadstarter
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 149

XP
D5 Prof.
BeitragVerfasst: Sa 05.11.05 14:51 
Funktioniert ihrgendwie doch net :crying: :bawling:
[img] www.ekiwi.de/scripts...&textfield=Hilfe [/img]

jetzt kommt ne fehlermeldung wenn ich auf Button2 klicke:


Im Projekt1.exe ist eine Exception der Klasse EAccesViolation aufgetreten ...
.

Unter google fand ich heraus das wenn EAccesViolation auftritt, ich ihrgendwas versuche zu speichern was ich aber net kann weil zB.meine Array net lang genug ist .

Kann damit aber leider nichts anfangen

Wäre net wenn ihr mir helfen könntet

_________________
Good, better , best
Waldheini
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 32

Win 98SE, XP
D5 St., K3 Prof
BeitragVerfasst: So 06.11.05 01:29 
Du hast recht, den gleichen Fehler erhalte ich auch, wenn ich PlaySound in Button2Click aufrufe. Schreibe einfach noch eine Funktion, die Du dort aufrufen kannst.
Das Ganze sollte dann so aussehen:


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
unit Unit1;

 
interface  


uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;


type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    function Play(FileName: PChar): Boolean;
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;


function PlaySound(pszSound:pchar;hmod:pointer;fdwSound:Cardinal):Boolean;
   cdecl;
   external 'winmm.dll' Name 'PlaySound';


Const
   SND_SYNC         = 0 ;   // synchron abspielen

var
  Form1: TForm1;


implementation


{$R *.DFM}


procedure TForm1.Button1Click(Sender: TObject);
begin
     close;
end;


procedure TForm1.Button2Click(Sender: TObject);
begin
      Play('\media\Test.wav');
end;

function TForm1.Play(FileName: PChar): Boolean;
begin
      Result:= PlaySound(FileName, Nil, SND_SYNC);
end;


end.
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 06.11.05 01:39 
statt der external deklaration tut es übrigens auch ein uses mmsystem

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

XP
D5 Prof.
BeitragVerfasst: So 06.11.05 11:56 
Funktiuniert einwandfrei :D :party: !!! vielen , vielen Dank :flehan:

_________________
Good, better , best