Autor Beitrag
lblbw
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 122

Win XP, Win 7
Delphi7 Enterprise
BeitragVerfasst: Fr 24.04.09 17:21 
Moin,

stehe gerade vor ein kleines Problem. Und zwar gibts ja in dem netten kleinen Beispiel netradio der Bass.dll folgenden Code:
ausblenden 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:
procedure TForm1.WndProc(var Msg: TMessage);
// to be threadsave we are passing all Canvas Stuff(e.g. Labels) to this messages
begin
  inherited;
  if Msg.Msg = WM_INFO_UPDATE then
    case msg.WParam of
      0:
        begin
          Label4.Caption := 'connecting...';
          Label3.Caption := '';
          Label5.Caption := '';
        end;
      1:
        begin
          Label4.Caption := 'not playing';
          Error('Can''t play the stream');
        end;
      2: Label4.Caption := Format('buffering... %d%%', [msg.LParam]);
      3: Label4.Caption := PChar(msg.LParam);
      4: Label5.Caption := PChar(msg.LParam);
      5: Label5.Caption := PChar(msg.LParam);
      6: Label3.Caption := PChar(msg.LParam);
      7: Label3.Caption := PChar(msg.LParam);
      8: Label5.Caption := PChar(msg.LParam);
    end;
end;


Wofür 0-2 stehen ist klar, wofür stehen aber die anderen Zahlen?

Ich habe die Funktionen angepasst, und in eine Klasse mit eingefügt (stark angepasste Player_Klasse aus dem MeMP-Tutorial von Gausi). Wie bekomme ich jetzt diese Titelinformationen des Radios, in meiner Unit?

Ich steh da grad ziemlich auf den Schlauch, und komm nicht darauf!

Thx for help!
ffgorcky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 573

WIN XP/2000 & 7Prof (Familie:Win95,Win98)

BeitragVerfasst: Sa 25.04.09 13:04 
Die anderen verursachen doch genauso eine Text-Ausgabe des Nachrichten-Parameters (also msg.LParam),
nur eben in verschiedenen Labels.
Aber wenn das alles (also wirklich die gesamte Prozedur) ist, dann weiß ich nicht, warum Msg als var - also als Variable übergeben wird. Da würde doch eigentlich das Ganze einfach ohne die Anweisung "var" reichen.
Sonst kann es ja passieren, dass man nachher die Prozedur doch noch abändert und dann nicht mehr daran denkt, dass sich die Änderung der Variable auch auf die aufrufende Prozedur auswirkt.
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: Sa 25.04.09 13:17 
Wenn ich das richtig sehe, dann wird diese Message (WM_INFO_UPDATE) von der bass.dll an das Fenster-Handle geschickt, das beim StreamCreate angegeben wird. Ganz in einer Klasse bringt das also nichts - das muss schon in der Form bleiben. Was jetzt die Parameter 3-8 genau bedeuten, weiß ich auch nicht, aber ich würde mal denken, dass das in der Hilfe zur Bass.dll drinsteht, oder aus dem Demoprogramm ersichtlich wird (einfach schauen, was da in den Labels dann steht).

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

Win XP, Win 7
Delphi7 Enterprise
BeitragVerfasst: Mo 27.04.09 17:45 
Danke euch beiden. Ich habs mal testweise ausgegliedert und in eine neue Anwendung gebracht. Dort funktioniert es, allerdings auch nicht jedesmal.

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:
procedure TForm1.FormCreate(Sender: TObject);
var
  sl: TStringList;
  t: String;
  i, Pos1: Integer;
begin
  ListBox1.Items.Clear;
  sl := TStringList.Create;
  try
    t:=ExtractFilePath(Application.ExeName);
    t:='urls.txt';
    sl.LoadFromFile(t);
    for i := 0 to sl.Count - 1 do
    begin
      Pos1 := Pos(';', sl[i]);
      ListBox1.Items.Add(Copy(sl[i],0,Pos1-1));
    end;
  finally
    sl.Free;
  end;
end;

procedure TForm1.ListBox1Click(Sender: TObject);
var
  sl: TStringList;
  t, RadNam, RadUrl, text: String;
  i, Pos1: Integer;
  ThreadId: Cardinal;  
begin
  sl := TStringList.Create;
  try
    t:=ExtractFilePath(Application.ExeName);
    t:='urls.txt';
    sl.LoadFromFile(t);
    for i := 0 to sl.Count - 1 do
    begin
      Pos1 := Pos(';', sl[i]);
      RadNam := Copy(sl[i],0,Pos1-1);
      if RadNam = listbox1.items.strings[listbox1.itemindex] then
      begin
        if (cthread <> 0) then
          MessageBeep(0)
        else
          cthread := BeginThread(nil, 0, @OpenURL, PChar(Copy(sl[i],Pos1+1,MaxInt)), 0, ThreadId);
      end;
    end;
  finally
    sl.Free;
  end;
end;


Ich denke, das die Einträge in der Listbox und in der urls.txt nicht genau übereinstimmen.
lblbw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 122

Win XP, Win 7
Delphi7 Enterprise
BeitragVerfasst: Do 30.04.09 21:36 
Ich bin immer noch am Fehlersuchen. Gebe ich die URL in einer ShowMessage oder Error() aus, spielt er ab. Nehm ich das raus, Fehler 404. Passe ich das Script an mein Hauptprojekt an, spielt er ab (und zwar immer), zeigt aber keine Titel an.........