Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi WinampApi Problem (https://www.delphipraxis.net/19569-winampapi-problem.html)

titus 5. Apr 2004 15:25


WinampApi Problem
 
Hi, ich hab mir die WinampApi mal gesaugt, und wenn ich jetzt folgenden Quelltext eingebe:
Delphi-Quellcode:
unit Unit1;

interface

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

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

var
  Form1: TForm1;
  WinAmp : TWinampApi;
  openPlay : Boolean;
  openPlayList : Boolean;
implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var WinAmp : TWinAmpApi;
begin
  // Make song length & position be returned in mm:ss format
  WinAmp.SongLengthParseTime := True;
  WinAmp.SongPosParseTime := True;

  Memo1.Text := '';
  Memo1.Lines.Add('Playing :'+Winamp.getWhatsPlaying);
  Memo1.Lines.Add('Song state: '+WinAmp.getSongState);
  Memo1.Lines.Add('Song position: '+WinAmp.getSongPosition);
  Memo1.Lines.Add('Song length: '+WinAmp.getSongLength);
  Memo1.Lines.Add('Song sample rate: '+WinAmp.getSongSampleRate);
  Memo1.Lines.Add('Song bitrate: '+WinAmp.getSongBitRate);
  Memo1.Lines.Add('Song channels: '+WinAmp.getSongChannels);
  Memo1.Lines.Add('Song play list position: '+WinAmp.getPlayListPosition +'/'+WinAmp.getPlayListLength);
end;

end.
Kommt in dem Memo1-Feld folgende Anzeige:
Zitat:

Playing :
Song state: stopped
Song position: 00:00
Song length: 00:00
Song sample rate: 0
Song bitrate: 0
Song channels: 0
Song play list position: 0/0
Das stimmt aber nicht.

Bitte helft mir...

mfG, LCD

mirage228 5. Apr 2004 15:27

Re: WinampApi Problem
 
Vielleicht musst bei der Variable "Winamp" ja noch eine Funktion aufrufen, die die Werte initialisiert oder so...

mfG
mirage228

titus 5. Apr 2004 15:33

Re: WinampApi Problem
 
Hm steht nix von in der Doku :(

Und auch nicht in der Beispiel Datei...

mfG, LCD

Markus K. 5. Apr 2004 15:39

Re: WinampApi Problem
 
Hallo,
ich bin mir nicht sicher, aber vielleicht musst du vorher erst eine Instanz von WinAmpApi erzeugen. z.B.:
Delphi-Quellcode:
var WinAmp : TWinAmpApi;
begin
     WinAmp:=TWinampApi.Create(WPath : String);
end;
Tschüß Markus

titus 5. Apr 2004 15:41

Re: WinampApi Problem
 
Thx, aber geht immer noch nicht :(

plz help

mfG, LCD

Markus K. 5. Apr 2004 15:45

Re: WinampApi Problem
 
Mir ist gerade auf gefallen, das du die Variable WinAmp zweimal deklariert hast.
Bin mir nicht sicher ob das geht.

Tschüß Markus

titus 5. Apr 2004 15:48

Re: WinampApi Problem
 
Wenn ichs hier raus lösche
Delphi-Quellcode:
var
  Form1: TForm1;
  openPlay : Boolean;
  openPlayList : Boolean;
implementation
(also den Code über implementation)
Dann passiert dasselbe, nix ändert sich, wenn ichs aus der Procedure lösche und über implementation lösche kommt ein Fehlermeldung: irgendwas mit einer Zugriffsverletzung...

mfG, LCD

Yheeky 5. Apr 2004 16:06

Re: WinampApi Problem
 
Mhmm, welche WinAmp Version hast du denn? Funktioniert meines Wissens nicht mit jeder Version...

Gruß Yheeky

titus 5. Apr 2004 16:07

Re: WinampApi Problem
 
Ok danke an der Version lags net, ich weiß net, ich hab einfach mal rumprobier jetzt gehts, wenn der Quelltext interessiert (maybe?):
Delphi-Quellcode:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  openPlay : Boolean;
  openPlayList : Boolean;
implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var WinAmp : TWinampApi;
begin
  WinAmp := TWinampApi.Create('C:\program files\winamp');
  // Make song length & position be returned in mm:ss format
  WinAmp.SongLengthParseTime := True;
  WinAmp.SongPosParseTime := True;

  Memo1.Text := '';
  Memo1.Lines.Add('Playing :'+Winamp.getWhatsPlaying);
  Memo1.Lines.Add('Song state: '+WinAmp.getSongState);
  Memo1.Lines.Add('Song position: '+WinAmp.getSongPosition);
  Memo1.Lines.Add('Song length: '+WinAmp.getSongLength);
  Memo1.Lines.Add('Song sample rate: '+WinAmp.getSongSampleRate);
  Memo1.Lines.Add('Song bitrate: '+WinAmp.getSongBitRate);
  Memo1.Lines.Add('Song channels: '+WinAmp.getSongChannels);
  Memo1.Lines.Add('Song play list position: '+WinAmp.getPlayListPosition +'/'+WinAmp.getPlayListLength);
end;

end.

DGS 12. Apr 2007 17:59

Re: WinampApi Problem
 
Zitat:

Zitat von titus
Hi, ich hab mir die WinampApi mal gesaugt,

Kann mir einer sagen, wo es die gibt?
( Suche ergab nur Fragen zur Benutzung der API )


Alle Zeitangaben in WEZ +1. Es ist jetzt 04:04 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz