Autor Beitrag
Adrian
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 314



BeitragVerfasst: Do 11.03.04 09:03 
Servus!

In einem Programm möchte ich zunächst die Winamp-Ausgabe pausieren, dann eine Wave-Datei ausgeben und anschließend Winamp weiterlaufen lassen.
Das ist zunächst auch nicht schwierig, denn:
- Taste "C" drücken und Winamp pausiert
- in meinem Progrämmchen die Wave ausgeben - über DelphiX
- Winamp wieder in Vordergrund holen und "C" drücken -> Wimamp dudelt wieder
Dann wollte ich das komplett in ein Programm bringen und schrieb:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Button1Click(Sender: TObject);
var
  hOE: hWnd;
begin
  hOE:=findwindow(PChar('Winamp v1.x'),nil);
  SetForegroundWindow(hOE);
  keybd_event(67,0,0,0);
  keybd_event(67,0,KEYEVENTF_KEYUP,0);
  
  hOE:=findwindow(PChar('AmpWin'),nil);
  SetForegroundWindow(hOE);
  DXWaveList1.Items[0].Play(False);
  
  hOE:=findwindow(PChar('Winamp v1.x'),nil);
  SetForegroundWindow(hOE);
  keybd_event(67,0,0,0);
  keybd_event(67,0,KEYEVENTF_KEYUP,0);
end;

Aber das funktioniert nicht!
Winamp legt zwar eine Pause ein, aber die Wave kommt nicht durch.
So, und jetzt kommen gleich 2 Fragen:
- Warum geht die Steuerung nicht aus dem Programm heraus?
- Wie kann ich mein Ziel erreichen?

Gruß,

Adrian
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Do 11.03.04 17:13 
also hast du schonmal geschaut, ob das wave abgespielt wird, wenn du das zeug mit winamp weglässt ??
ansonsten würde ich das mit apsue usw nocht über tastenbrücke machen, sondern die winamp api ansprechen. geh mal auf die winamp seite und schau dir dort das sdk an. oder such im forum mal nach Suche in: Delphi-Forum, Delphi-Library WINAMP

_________________
In the beginning was the word.
And the word was content-type: text/plain.
G-McKree
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 178



BeitragVerfasst: Do 11.03.04 23:12 
das SDK zu winamp is n C geschrieben...
Adrian Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 314



BeitragVerfasst: Fr 12.03.04 08:55 
Servus!

Zur Frage von matze: Ohne die Winamp-Behandlung wird die Wave sauber abgespielt, und Winamp dudelt fröhlich mit.
@ G-McKree: Ja, leider.

Gruß,

Adrian
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 12.03.04 12:12 
nein, du kannst nämlich winamp mit hilfe von windowmessages steuern
also infos über winamp kannst z.b. so abfragen:
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:
procedure TForm1.Timer1Timer(Sender: TObject);
var hwndWinamp : THandle;
    temp:integer;
begin
hwndWinamp := FindWindow('Winamp v1.x', nil);
memo1.Clear;

if hwndWinamp = 0 then begin
   memo1.lines.Add ('winamp not active');
   exit;
   end;

   memo1.lines.add ('   winamp handle: '+IntToStr(hwndWinamp));
   memo1.lines.add ('  winamp version: '+Inttostr(sendmessage (hwndWinamp,WM_USER,0,0)));
   memo1.lines.add ('  track pos (ms): '+Inttostr(sendmessage (hwndWinamp,WM_USER,0,105)));
   memo1.lines.add ('track lenght (s): '+Inttostr(sendmessage (hwndWinamp,WM_USER,1,105)));
   memo1.lines.add (' playlist tracks: '+Inttostr(sendmessage (hwndWinamp,WM_USER,0,124)));
   memo1.lines.add ('   track playing: '+Inttostr(sendmessage (hwndWinamp,WM_USER,0,125)));
   memo1.lines.add ('track samplerate: '+Inttostr(sendmessage (hwndWinamp,WM_USER,0,126)));
   memo1.lines.add ('   track bitrate: '+Inttostr(sendmessage (hwndWinamp,WM_USER,1,126)));
   memo1.lines.add ('  track channels: '+Inttostr(sendmessage (hwndWinamp,WM_USER,2,126)));
   memo1.lines.add ('    EQ activated: '+Inttostr(sendmessage (hwndWinamp,WM_USER,11,127)));

   memo1.lines.add ('');

temp := sendmessage (hwndWinamp,WM_USER,0,104);
case temp of
1: memo1.lines.add ('winamp is playing');
3: memo1.lines.add ('winamp is paused');
else
   memo1.lines.add ('winamp is stopped');
end;
end;

und solche commands gibt es auch um winamp zu apsuieren und starten (glaube ich)

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



BeitragVerfasst: Fr 12.03.04 13:06 
Servus!

@matze: Danke für den Code! Sobald ich wieder an meinem PC sitze, werde ich versuchen, ob ich mit ihm weiterkomme.
Was bedeutet das "Nein"?

Gruß,

Adrian
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 12.03.04 13:15 
hmmm.... ich verneiene da die aussage, dass es das SDK nur in C gibt. ich hatte noch die alte Winamp Developers page im hinterkopf, da gabs diese ganzen befehle auch mit Delphi codes aufgelistet. die hat nullsoft aber aus der website geschmissen. auch die codes für dei windowmessages find ich grad nichtmehr...

_________________
In the beginning was the word.
And the word was content-type: text/plain.